diff --git a/src/NadekoBot/.editorconfig b/src/NadekoBot/.editorconfig index 3a0554428..c543a2633 100644 --- a/src/NadekoBot/.editorconfig +++ b/src/NadekoBot/.editorconfig @@ -1,9 +1,13 @@ root = true # Remove the line below if you want to inherit .editorconfig settings from higher directories +[obj/**] +generated_code = true + # C# files [*.cs] + #### Core EditorConfig Options #### # Indentation and spacing @@ -263,7 +267,7 @@ dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, int dotnet_naming_symbols.non_field_members.required_modifiers = dotnet_naming_symbols.private_readonly_field.applicable_kinds = field -dotnet_naming_symbols.private_readonly_field.applicable_accessibilities = private +dotnet_naming_symbols.private_readonly_field.applicable_accessibilities = private, protected dotnet_naming_symbols.private_readonly_field.required_modifiers = readonly dotnet_naming_symbols.private_field.applicable_kinds = field @@ -327,7 +331,7 @@ resharper_wrap_before_invocation_rpar = false resharper_csharp_wrap_after_declaration_lpar = true resharper_csharp_wrap_before_invocation_rpar = true resharper_csharp_wrap_parameters_style = chop_if_long -resharper_force_chop_compound_if_expression = true +resharper_force_chop_compound_if_expression = false resharper_keep_existing_linebreaks = false resharper_max_formal_parameters_on_line = 3 resharper_wrap_chained_binary_expressions = chop_if_long diff --git a/src/NadekoBot/Bot.cs b/src/NadekoBot/Bot.cs index 4bf0d1cc3..d48263e8a 100644 --- a/src/NadekoBot/Bot.cs +++ b/src/NadekoBot/Bot.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +#nullable disable +using Microsoft.Extensions.DependencyInjection; using NadekoBot.Services.Database.Models; using System.Collections.Immutable; using System.Diagnostics; @@ -54,6 +55,7 @@ public sealed class Bot AlwaysDownloadUsers = false, AlwaysResolveStickers = false, AlwaysDownloadDefaultStickers = false, + GatewayIntents = GatewayIntents.All, }); _commandService = new(new() @@ -354,4 +356,4 @@ public sealed class Bot await RunAsync().ConfigureAwait(false); await Task.Delay(-1).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/AddRemove.cs b/src/NadekoBot/Common/AddRemove.cs index 5578cb253..a8f558fdf 100644 --- a/src/NadekoBot/Common/AddRemove.cs +++ b/src/NadekoBot/Common/AddRemove.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public enum AddRemove { @@ -6,4 +7,4 @@ public enum AddRemove Remove = int.MinValue + 1, Rem = int.MinValue + 1, Rm = int.MinValue + 1, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/AsyncLazy.cs b/src/NadekoBot/Common/AsyncLazy.cs index e155b4202..05cf162ae 100644 --- a/src/NadekoBot/Common/AsyncLazy.cs +++ b/src/NadekoBot/Common/AsyncLazy.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +#nullable disable +using System.Runtime.CompilerServices; namespace NadekoBot.Common; @@ -16,4 +17,4 @@ public class AsyncLazy : Lazy> public TaskAwaiter GetAwaiter() => Value.GetAwaiter(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/Aliases.cs b/src/NadekoBot/Common/Attributes/Aliases.cs index 9b7856965..407e6f783 100644 --- a/src/NadekoBot/Common/Attributes/Aliases.cs +++ b/src/NadekoBot/Common/Attributes/Aliases.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace NadekoBot.Common.Attributes; @@ -9,4 +9,4 @@ public sealed class AliasesAttribute : AliasAttribute : base(CommandNameLoadHelper.GetAliasesFor(memberName)) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/CommandNameLoadHelper.cs b/src/NadekoBot/Common/Attributes/CommandNameLoadHelper.cs index f4bb3ab9c..b8bed1ebb 100644 --- a/src/NadekoBot/Common/Attributes/CommandNameLoadHelper.cs +++ b/src/NadekoBot/Common/Attributes/CommandNameLoadHelper.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.Attributes; +namespace NadekoBot.Common.Attributes; public static class CommandNameLoadHelper { @@ -26,4 +26,4 @@ public static class CommandNameLoadHelper : methodName; return toReturn; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/NadekoCommand.cs b/src/NadekoBot/Common/Attributes/NadekoCommand.cs index 76ef11ac0..4bd6bd6c9 100644 --- a/src/NadekoBot/Common/Attributes/NadekoCommand.cs +++ b/src/NadekoBot/Common/Attributes/NadekoCommand.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace NadekoBot.Common.Attributes; @@ -10,4 +10,4 @@ public sealed class NadekoCommandAttribute : CommandAttribute => this.MethodName = memberName.ToLowerInvariant(); public string MethodName { get; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs b/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs index 0e3207a76..39e859bbd 100644 --- a/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs +++ b/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.Attributes; +namespace NadekoBot.Common.Attributes; [AttributeUsage(AttributeTargets.Class)] internal sealed class NadekoModuleAttribute : GroupAttribute @@ -7,4 +7,4 @@ internal sealed class NadekoModuleAttribute : GroupAttribute : base(moduleName) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/NadekoOptions.cs b/src/NadekoBot/Common/Attributes/NadekoOptions.cs index 5dd506cf3..a071f9900 100644 --- a/src/NadekoBot/Common/Attributes/NadekoOptions.cs +++ b/src/NadekoBot/Common/Attributes/NadekoOptions.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.Attributes; +namespace NadekoBot.Common.Attributes; [AttributeUsage(AttributeTargets.Method)] public sealed class NadekoOptionsAttribute : Attribute @@ -7,4 +7,4 @@ public sealed class NadekoOptionsAttribute : Attribute public NadekoOptionsAttribute(Type t) => this.OptionType = t; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs b/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs index 35c900cfb..533b6a820 100644 --- a/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs +++ b/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; namespace NadekoBot.Common.Attributes; @@ -17,4 +17,4 @@ public sealed class OwnerOnlyAttribute : PreconditionAttribute : PreconditionResult.FromError("Not owner") ); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/Ratelimit.cs b/src/NadekoBot/Common/Attributes/Ratelimit.cs index 6eff6abb4..e03aa6b58 100644 --- a/src/NadekoBot/Common/Attributes/Ratelimit.cs +++ b/src/NadekoBot/Common/Attributes/Ratelimit.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; namespace NadekoBot.Common.Attributes; @@ -33,4 +33,4 @@ public sealed class RatelimitAttribute : PreconditionAttribute return Task.FromResult(PreconditionResult.FromError(msgContent)); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Attributes/UserPerm.cs b/src/NadekoBot/Common/Attributes/UserPerm.cs index 3d0743f9d..cd393dbf1 100644 --- a/src/NadekoBot/Common/Attributes/UserPerm.cs +++ b/src/NadekoBot/Common/Attributes/UserPerm.cs @@ -1,9 +1,9 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using NadekoBot.Modules.Administration.Services; namespace Discord; -[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] +[AttributeUsage(AttributeTargets.Method)] public class UserPermAttribute : RequireUserPermissionAttribute { public override Task CheckPermissionsAsync( @@ -27,4 +27,4 @@ public class UserPermAttribute : RequireUserPermissionAttribute : base(permission) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/CmdStrings.cs b/src/NadekoBot/Common/CmdStrings.cs index 1d81823ac..5f120a7d6 100644 --- a/src/NadekoBot/Common/CmdStrings.cs +++ b/src/NadekoBot/Common/CmdStrings.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Common; @@ -13,4 +14,4 @@ public class CmdStrings Usages = usages; Description = description; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Collections/ConcurrentHashSet.cs b/src/NadekoBot/Common/Collections/ConcurrentHashSet.cs index 8beb73355..f87b756ac 100644 --- a/src/NadekoBot/Common/Collections/ConcurrentHashSet.cs +++ b/src/NadekoBot/Common/Collections/ConcurrentHashSet.cs @@ -1,4 +1,5 @@ -// License MIT +#nullable disable +// License MIT // Source: https://github.com/i3arnon/ConcurrentHashSet using System.Diagnostics; @@ -810,4 +811,4 @@ public sealed class ConcurrentHashSet : IReadOnlyCollection, ICollection : IList } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/CommandData.cs b/src/NadekoBot/Common/CommandData.cs index c56e4374d..a20fe3e44 100644 --- a/src/NadekoBot/Common/CommandData.cs +++ b/src/NadekoBot/Common/CommandData.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public class CommandData { public string Cmd { get; set; } public string Desc { get; set; } public string[] Usage { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Configs/BotConfig.cs b/src/NadekoBot/Common/Configs/BotConfig.cs index 53f208132..23558e29a 100644 --- a/src/NadekoBot/Common/Configs/BotConfig.cs +++ b/src/NadekoBot/Common/Configs/BotConfig.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; using Cloneable; using NadekoBot.Common.Yml; using SixLabors.ImageSharp.PixelFormats; @@ -188,4 +189,4 @@ public enum ConsoleOutputType Normal = 0, Simple = 1, None = 2, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Configs/IConfigSeria.cs b/src/NadekoBot/Common/Configs/IConfigSeria.cs index 98254e635..7e08bc857 100644 --- a/src/NadekoBot/Common/Configs/IConfigSeria.cs +++ b/src/NadekoBot/Common/Configs/IConfigSeria.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.Configs; +namespace NadekoBot.Common.Configs; /// /// Base interface for available config serializers @@ -8,10 +8,11 @@ public interface IConfigSeria /// /// Serialize the object to string /// - public string Serialize(T obj); + public string Serialize(T obj) + where T: notnull; /// /// Deserialize string data into an object of the specified type /// public T Deserialize(string data); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Creds.cs b/src/NadekoBot/Common/Creds.cs index fa0c4d46d..a12ac5ce5 100644 --- a/src/NadekoBot/Common/Creds.cs +++ b/src/NadekoBot/Common/Creds.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Yml; +#nullable disable +using NadekoBot.Common.Yml; namespace NadekoBot.Common; @@ -238,4 +239,4 @@ This should be equivalent to the DiscordsKey in your NadekoBot.Votes api appsett public string Args { get; set; } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/DownloadTracker.cs b/src/NadekoBot/Common/DownloadTracker.cs index 5c6afc06e..9ccdcd1bd 100644 --- a/src/NadekoBot/Common/DownloadTracker.cs +++ b/src/NadekoBot/Common/DownloadTracker.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public class DownloadTracker : INService { @@ -32,4 +33,4 @@ public class DownloadTracker : INService _downloadUsersSemaphore.Release(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Helpers.cs b/src/NadekoBot/Common/Helpers.cs index 9b7d9fbbf..446216134 100644 --- a/src/NadekoBot/Common/Helpers.cs +++ b/src/NadekoBot/Common/Helpers.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public static class Helpers { @@ -9,4 +10,4 @@ public static class Helpers Environment.Exit(exitCode); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/IBotCredentials.cs b/src/NadekoBot/Common/IBotCredentials.cs index 9dea7994f..1de96cb65 100644 --- a/src/NadekoBot/Common/IBotCredentials.cs +++ b/src/NadekoBot/Common/IBotCredentials.cs @@ -1,4 +1,5 @@ -namespace NadekoBot; +#nullable disable +namespace NadekoBot; public interface IBotCredentials { @@ -26,4 +27,4 @@ public class RestartConfig { public string Cmd { get; set; } public string Args { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ICloneable.cs b/src/NadekoBot/Common/ICloneable.cs index 59782c22e..95010347f 100644 --- a/src/NadekoBot/Common/ICloneable.cs +++ b/src/NadekoBot/Common/ICloneable.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public interface ICloneable where T : new() { public T Clone(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/IEmbedBuilder.cs b/src/NadekoBot/Common/IEmbedBuilder.cs index bf47f8bb4..5434bcbb7 100644 --- a/src/NadekoBot/Common/IEmbedBuilder.cs +++ b/src/NadekoBot/Common/IEmbedBuilder.cs @@ -1,4 +1,5 @@ -namespace NadekoBot; +#nullable disable +namespace NadekoBot; public interface IEmbedBuilder { @@ -19,4 +20,4 @@ public enum EmbedColor Ok, Pending, Error, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/INadekoCommandOptions.cs b/src/NadekoBot/Common/INadekoCommandOptions.cs index 13c157554..be44c6618 100644 --- a/src/NadekoBot/Common/INadekoCommandOptions.cs +++ b/src/NadekoBot/Common/INadekoCommandOptions.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public interface INadekoCommandOptions { void NormalizeOptions(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/IPlaceholderProvider.cs b/src/NadekoBot/Common/IPlaceholderProvider.cs index cf9c94072..b33d8c026 100644 --- a/src/NadekoBot/Common/IPlaceholderProvider.cs +++ b/src/NadekoBot/Common/IPlaceholderProvider.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public interface IPlaceholderProvider { public IEnumerable<(string Name, Func Func)> GetPlaceholders(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ImageUrls.cs b/src/NadekoBot/Common/ImageUrls.cs index c4fdf4cda..2c022508e 100644 --- a/src/NadekoBot/Common/ImageUrls.cs +++ b/src/NadekoBot/Common/ImageUrls.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Yml; +#nullable disable +using NadekoBot.Common.Yml; namespace NadekoBot.Common; @@ -45,4 +46,4 @@ public class ImageUrls { public Uri Bg { get; set; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/JsonConverters/CultureInfoConverter.cs b/src/NadekoBot/Common/JsonConverters/CultureInfoConverter.cs index 0d23c338b..896ab5137 100644 --- a/src/NadekoBot/Common/JsonConverters/CultureInfoConverter.cs +++ b/src/NadekoBot/Common/JsonConverters/CultureInfoConverter.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; @@ -11,4 +11,4 @@ public class CultureInfoConverter : JsonConverter public override void Write(Utf8JsonWriter writer, CultureInfo value, JsonSerializerOptions options) => writer.WriteStringValue(value.Name); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/JsonConverters/Rgba32Converter.cs b/src/NadekoBot/Common/JsonConverters/Rgba32Converter.cs index eba8dbcf2..40091d746 100644 --- a/src/NadekoBot/Common/JsonConverters/Rgba32Converter.cs +++ b/src/NadekoBot/Common/JsonConverters/Rgba32Converter.cs @@ -1,4 +1,4 @@ -using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.PixelFormats; using System.Text.Json; using System.Text.Json.Serialization; @@ -11,4 +11,4 @@ public class Rgba32Converter : JsonConverter public override void Write(Utf8JsonWriter writer, Rgba32 value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToHex()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Kwum.cs b/src/NadekoBot/Common/Kwum.cs index 4174be695..0b27c1615 100644 --- a/src/NadekoBot/Common/Kwum.cs +++ b/src/NadekoBot/Common/Kwum.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +#nullable disable +using System.Runtime.CompilerServices; namespace NadekoBot.Common; @@ -95,4 +96,4 @@ public readonly struct kwum : IEquatable public override int GetHashCode() => _value.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/LbOpts.cs b/src/NadekoBot/Common/LbOpts.cs index 58a624412..d47beb8e0 100644 --- a/src/NadekoBot/Common/LbOpts.cs +++ b/src/NadekoBot/Common/LbOpts.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; namespace NadekoBot.Common; @@ -14,4 +15,4 @@ public class LbOpts : INadekoCommandOptions public void NormalizeOptions() { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/LoginErrorHandler.cs b/src/NadekoBot/Common/LoginErrorHandler.cs index 290d9b961..032149241 100644 --- a/src/NadekoBot/Common/LoginErrorHandler.cs +++ b/src/NadekoBot/Common/LoginErrorHandler.cs @@ -1,4 +1,5 @@ -using System.Net; +#nullable disable +using System.Net; using System.Runtime.CompilerServices; namespace NadekoBot.Common; @@ -52,4 +53,4 @@ public class LoginErrorHandler Log.Fatal(ex, "Fatal error occurred while loading credentials"); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ModuleBehaviors/IEarlyBehavior.cs b/src/NadekoBot/Common/ModuleBehaviors/IEarlyBehavior.cs index a569becf7..28884689a 100644 --- a/src/NadekoBot/Common/ModuleBehaviors/IEarlyBehavior.cs +++ b/src/NadekoBot/Common/ModuleBehaviors/IEarlyBehavior.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.ModuleBehaviors; +namespace NadekoBot.Common.ModuleBehaviors; /// /// Implemented by modules which block execution before anything is executed @@ -7,4 +7,4 @@ public interface IEarlyBehavior { int Priority { get; } Task RunBehavior(IGuild guild, IUserMessage msg); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ModuleBehaviors/IInputTransformer.cs b/src/NadekoBot/Common/ModuleBehaviors/IInputTransformer.cs index fedd67c85..46e4627e8 100644 --- a/src/NadekoBot/Common/ModuleBehaviors/IInputTransformer.cs +++ b/src/NadekoBot/Common/ModuleBehaviors/IInputTransformer.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.ModuleBehaviors; +namespace NadekoBot.Common.ModuleBehaviors; public interface IInputTransformer { @@ -7,4 +7,4 @@ public interface IInputTransformer IMessageChannel channel, IUser user, string input); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ModuleBehaviors/ILateBlocker.cs b/src/NadekoBot/Common/ModuleBehaviors/ILateBlocker.cs index d6c5456fd..6603e5ffe 100644 --- a/src/NadekoBot/Common/ModuleBehaviors/ILateBlocker.cs +++ b/src/NadekoBot/Common/ModuleBehaviors/ILateBlocker.cs @@ -1,8 +1,8 @@ -namespace NadekoBot.Common.ModuleBehaviors; +namespace NadekoBot.Common.ModuleBehaviors; public interface ILateBlocker { public int Priority { get; } Task TryBlockLate(ICommandContext context, string moduleName, CommandInfo command); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ModuleBehaviors/ILateExecutor.cs b/src/NadekoBot/Common/ModuleBehaviors/ILateExecutor.cs index c7d826a6e..7d855751f 100644 --- a/src/NadekoBot/Common/ModuleBehaviors/ILateExecutor.cs +++ b/src/NadekoBot/Common/ModuleBehaviors/ILateExecutor.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.ModuleBehaviors; +namespace NadekoBot.Common.ModuleBehaviors; /// /// Last thing to be executed, won't stop further executions @@ -6,4 +6,4 @@ public interface ILateExecutor { Task LateExecute(IGuild guild, IUserMessage msg); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ModuleBehaviors/IReadyExecutor.cs b/src/NadekoBot/Common/ModuleBehaviors/IReadyExecutor.cs index 82dd566b5..fcd553664 100644 --- a/src/NadekoBot/Common/ModuleBehaviors/IReadyExecutor.cs +++ b/src/NadekoBot/Common/ModuleBehaviors/IReadyExecutor.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common.ModuleBehaviors; +namespace NadekoBot.Common.ModuleBehaviors; /// /// All services which need to execute something after @@ -10,4 +10,4 @@ public interface IReadyExecutor /// Executed when bot is ready /// public Task OnReadyAsync(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/NadekoModule.cs b/src/NadekoBot/Common/NadekoModule.cs index e7ce08211..3d89c8261 100644 --- a/src/NadekoBot/Common/NadekoModule.cs +++ b/src/NadekoBot/Common/NadekoModule.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; // ReSharper disable InconsistentNaming namespace NadekoBot.Modules; @@ -164,4 +165,4 @@ public abstract class NadekoSubmodule : NadekoModule public abstract class NadekoSubmodule : NadekoModule { -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/NadekoRandom.cs b/src/NadekoBot/Common/NadekoRandom.cs index 7edb67683..59d17ef29 100644 --- a/src/NadekoBot/Common/NadekoRandom.cs +++ b/src/NadekoBot/Common/NadekoRandom.cs @@ -1,4 +1,5 @@ -using System.Security.Cryptography; +#nullable disable +using System.Security.Cryptography; namespace NadekoBot.Common; @@ -66,4 +67,4 @@ public class NadekoRandom : Random _rng.GetBytes(bytes); return BitConverter.ToDouble(bytes, 0); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/NoPublicBotPrecondition.cs b/src/NadekoBot/Common/NoPublicBotPrecondition.cs index 8a6ca8d93..271e71590 100644 --- a/src/NadekoBot/Common/NoPublicBotPrecondition.cs +++ b/src/NadekoBot/Common/NoPublicBotPrecondition.cs @@ -1,4 +1,5 @@ -using System.Diagnostics.CodeAnalysis; +#nullable disable +using System.Diagnostics.CodeAnalysis; namespace NadekoBot.Common; @@ -14,4 +15,4 @@ public sealed class NoPublicBotAttribute : PreconditionAttribute return Task.FromResult(PreconditionResult.FromSuccess()); #endif } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/OldImageUrls.cs b/src/NadekoBot/Common/OldImageUrls.cs index 58f52319b..4e31905c0 100644 --- a/src/NadekoBot/Common/OldImageUrls.cs +++ b/src/NadekoBot/Common/OldImageUrls.cs @@ -1,3 +1,4 @@ +#nullable disable namespace NadekoBot.Common; public class OldImageUrls @@ -43,4 +44,4 @@ public class OldImageUrls { public Uri Bg { get; set; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/OptionsParser.cs b/src/NadekoBot/Common/OptionsParser.cs index ae6c85e69..39b62fcfa 100644 --- a/src/NadekoBot/Common/OptionsParser.cs +++ b/src/NadekoBot/Common/OptionsParser.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; namespace NadekoBot.Common; @@ -21,4 +22,4 @@ public static class OptionsParser options.NormalizeOptions(); return (options, res.Tag == ParserResultType.Parsed); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/OsuMapData.cs b/src/NadekoBot/Common/OsuMapData.cs index 8ea5aff34..004c005f0 100644 --- a/src/NadekoBot/Common/OsuMapData.cs +++ b/src/NadekoBot/Common/OsuMapData.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public class OsuMapData { public string Title { get; set; } public string Artist { get; set; } public string Version { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/OsuUserBets.cs b/src/NadekoBot/Common/OsuUserBets.cs index 97c376306..a2b26521d 100644 --- a/src/NadekoBot/Common/OsuUserBets.cs +++ b/src/NadekoBot/Common/OsuUserBets.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Common; @@ -54,4 +55,4 @@ public class OsuUserBests [JsonProperty("replay_available")] public string ReplayAvailable { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/PlatformHelper.cs b/src/NadekoBot/Common/PlatformHelper.cs index fc3fcbafd..c067cd47d 100644 --- a/src/NadekoBot/Common/PlatformHelper.cs +++ b/src/NadekoBot/Common/PlatformHelper.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public static class PlatformHelper { @@ -22,4 +23,4 @@ public static class PlatformHelper return processorCount; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Pokemon/PokemonNameId.cs b/src/NadekoBot/Common/Pokemon/PokemonNameId.cs index 58c3c71d6..5219a4196 100644 --- a/src/NadekoBot/Common/Pokemon/PokemonNameId.cs +++ b/src/NadekoBot/Common/Pokemon/PokemonNameId.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Common.Pokemon; +#nullable disable +namespace NadekoBot.Common.Pokemon; public class PokemonNameId { public int Id { get; set; } public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Pokemon/SearchPokemon.cs b/src/NadekoBot/Common/Pokemon/SearchPokemon.cs index d99845531..e189a5a7d 100644 --- a/src/NadekoBot/Common/Pokemon/SearchPokemon.cs +++ b/src/NadekoBot/Common/Pokemon/SearchPokemon.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Common.Pokemon; @@ -37,4 +38,4 @@ public class SearchPokemon public string Color { get; set; } public string[] Evos { get; set; } public string[] EggGroups { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Pokemon/SearchPokemonAbility.cs b/src/NadekoBot/Common/Pokemon/SearchPokemonAbility.cs index ca48ff230..2d4d83ba1 100644 --- a/src/NadekoBot/Common/Pokemon/SearchPokemonAbility.cs +++ b/src/NadekoBot/Common/Pokemon/SearchPokemonAbility.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.Pokemon; +#nullable disable +namespace NadekoBot.Common.Pokemon; public class SearchPokemonAbility { @@ -6,4 +7,4 @@ public class SearchPokemonAbility public string ShortDesc { get; set; } public string Name { get; set; } public float Rating { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/PubSub/EventPubSub.cs b/src/NadekoBot/Common/PubSub/EventPubSub.cs index eada3d880..bc46a660c 100644 --- a/src/NadekoBot/Common/PubSub/EventPubSub.cs +++ b/src/NadekoBot/Common/PubSub/EventPubSub.cs @@ -1,13 +1,13 @@ -namespace NadekoBot.Common; +namespace NadekoBot.Common; public class EventPubSub : IPubSub { - private readonly Dictionary>>> _actions = new(); + private readonly Dictionary>>> _actions = new(); private readonly object _locker = new(); - public Task Sub(in TypedKey key, Func action) + public Task Sub(in TypedKey key, Func action) { - Func localAction = obj => action((TData)obj); + Func localAction = obj => action((TData?)obj); lock (_locker) { if (!_actions.TryGetValue(key.Key, out var keyActions)) @@ -79,4 +79,4 @@ public class EventPubSub : IPubSub return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/PubSub/IPubSub.cs b/src/NadekoBot/Common/PubSub/IPubSub.cs index aac56a65c..a9154d5fd 100644 --- a/src/NadekoBot/Common/PubSub/IPubSub.cs +++ b/src/NadekoBot/Common/PubSub/IPubSub.cs @@ -1,7 +1,7 @@ -namespace NadekoBot.Common; +namespace NadekoBot.Common; public interface IPubSub { public Task Pub(in TypedKey key, TData data); - public Task Sub(in TypedKey key, Func action); -} \ No newline at end of file + public Task Sub(in TypedKey key, Func action); +} diff --git a/src/NadekoBot/Common/PubSub/ISeria.cs b/src/NadekoBot/Common/PubSub/ISeria.cs index 5e48295b3..7a538aaef 100644 --- a/src/NadekoBot/Common/PubSub/ISeria.cs +++ b/src/NadekoBot/Common/PubSub/ISeria.cs @@ -1,7 +1,7 @@ -namespace NadekoBot.Common; +namespace NadekoBot.Common; public interface ISeria { byte[] Serialize(T data); - T Deserialize(byte[] data); -} \ No newline at end of file + T? Deserialize(byte[]? data); +} diff --git a/src/NadekoBot/Common/PubSub/JsonSeria.cs b/src/NadekoBot/Common/PubSub/JsonSeria.cs index e60d805c0..eda11f9ed 100644 --- a/src/NadekoBot/Common/PubSub/JsonSeria.cs +++ b/src/NadekoBot/Common/PubSub/JsonSeria.cs @@ -1,4 +1,4 @@ -using System.Text.Json; +using System.Text.Json; using NadekoBot.Common.JsonConverters; namespace NadekoBot.Common; @@ -13,11 +13,11 @@ public class JsonSeria : ISeria public byte[] Serialize(T data) => JsonSerializer.SerializeToUtf8Bytes(data, _serializerOptions); - public T Deserialize(byte[] data) + public T? Deserialize(byte[]? data) { if (data is null) return default; return JsonSerializer.Deserialize(data, _serializerOptions); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/PubSub/RedisPubSub.cs b/src/NadekoBot/Common/PubSub/RedisPubSub.cs index 722c5a4cd..29c997377 100644 --- a/src/NadekoBot/Common/PubSub/RedisPubSub.cs +++ b/src/NadekoBot/Common/PubSub/RedisPubSub.cs @@ -1,4 +1,4 @@ -using StackExchange.Redis; +using StackExchange.Redis; namespace NadekoBot.Common; @@ -22,7 +22,7 @@ public sealed class RedisPubSub : IPubSub .PublishAsync($"{_creds.RedisKey()}:{key.Key}", serialized, CommandFlags.FireAndForget); } - public Task Sub(in TypedKey key, Func action) + public Task Sub(in TypedKey key, Func action) { var eventName = key.Key; @@ -41,4 +41,4 @@ public sealed class RedisPubSub : IPubSub return _multi.GetSubscriber().SubscribeAsync($"{_creds.RedisKey()}:{eventName}", OnSubscribeHandler); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/PubSub/TypedKey.cs b/src/NadekoBot/Common/PubSub/TypedKey.cs index d03f81e0f..b7d2cc054 100644 --- a/src/NadekoBot/Common/PubSub/TypedKey.cs +++ b/src/NadekoBot/Common/PubSub/TypedKey.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Common; +namespace NadekoBot.Common; public readonly struct TypedKey { @@ -19,7 +19,7 @@ public readonly struct TypedKey public static bool operator !=(in TypedKey left, in TypedKey right) => !(left == right); - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is TypedKey o && o == this; public override int GetHashCode() @@ -27,4 +27,4 @@ public readonly struct TypedKey public override string ToString() => Key; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/PubSub/YamlSeria.cs b/src/NadekoBot/Common/PubSub/YamlSeria.cs index 3f3784961..b885ee666 100644 --- a/src/NadekoBot/Common/PubSub/YamlSeria.cs +++ b/src/NadekoBot/Common/PubSub/YamlSeria.cs @@ -22,6 +22,7 @@ public class YamlSeria : IConfigSeria } public string Serialize(T obj) + where T: notnull { var escapedOutput = _serializer.Serialize(obj); var output = _codePointRegex.Replace(escapedOutput, @@ -37,4 +38,4 @@ public class YamlSeria : IConfigSeria public T Deserialize(string data) => _deserializer.Deserialize(data); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Replacements/ReplacementBuilder.cs b/src/NadekoBot/Common/Replacements/ReplacementBuilder.cs index b31c26daf..fa3abf8b0 100644 --- a/src/NadekoBot/Common/Replacements/ReplacementBuilder.cs +++ b/src/NadekoBot/Common/Replacements/ReplacementBuilder.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; using System.Text.RegularExpressions; namespace NadekoBot.Common; @@ -56,6 +57,7 @@ public class ReplacementBuilder public ReplacementBuilder WithServer(DiscordSocketClient client, SocketGuild g) { + _reps.TryAdd("%server%", () => g is null ? "DM" : g.Name); _reps.TryAdd("%server.id%", () => g is null ? "DM" : g.Id.ToString()); _reps.TryAdd("%server.name%", () => g is null ? "DM" : g.Name); _reps.TryAdd("%server.members%", () => g is { } sg ? sg.MemberCount.ToString() : "?"); @@ -97,6 +99,7 @@ public class ReplacementBuilder public ReplacementBuilder WithManyUsers(IEnumerable users) { + _reps.TryAdd("%user%", () => string.Join(" ", users.Select(user => user.Mention))); _reps.TryAdd("%user.mention%", () => string.Join(" ", users.Select(user => user.Mention))); _reps.TryAdd("%user.fullname%", () => string.Join(" ", users.Select(user => user.ToString()))); _reps.TryAdd("%user.name%", () => string.Join(" ", users.Select(user => user.Username))); @@ -171,4 +174,4 @@ public class ReplacementBuilder return this; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Replacements/Replacer.cs b/src/NadekoBot/Common/Replacements/Replacer.cs index 210f889cd..ce253a42b 100644 --- a/src/NadekoBot/Common/Replacements/Replacer.cs +++ b/src/NadekoBot/Common/Replacements/Replacer.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +#nullable disable +using System.Text.RegularExpressions; namespace NadekoBot.Common; @@ -89,4 +90,4 @@ public class Replacer return newEmbedData; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/RequireObjectPropertiesContractResolver.cs b/src/NadekoBot/Common/RequireObjectPropertiesContractResolver.cs index c79b47404..1f57ac1d0 100644 --- a/src/NadekoBot/Common/RequireObjectPropertiesContractResolver.cs +++ b/src/NadekoBot/Common/RequireObjectPropertiesContractResolver.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace NadekoBot.Common; @@ -11,4 +12,4 @@ public class RequireObjectPropertiesContractResolver : DefaultContractResolver contract.ItemRequired = Required.DisallowNull; return contract; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/ShmartNumber.cs b/src/NadekoBot/Common/ShmartNumber.cs index 2f8d1729a..72dcc4f5a 100644 --- a/src/NadekoBot/Common/ShmartNumber.cs +++ b/src/NadekoBot/Common/ShmartNumber.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public struct ShmartNumber : IEquatable { @@ -37,4 +38,4 @@ public struct ShmartNumber : IEquatable public static bool operator !=(ShmartNumber left, ShmartNumber right) => !(left == right); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SmartText/SmartEmbedText.cs b/src/NadekoBot/Common/SmartText/SmartEmbedText.cs index 3ef18b984..91176f0fe 100644 --- a/src/NadekoBot/Common/SmartText/SmartEmbedText.cs +++ b/src/NadekoBot/Common/SmartText/SmartEmbedText.cs @@ -1,4 +1,5 @@ -namespace NadekoBot; +#nullable disable +namespace NadekoBot; public sealed record SmartEmbedText : SmartText { @@ -115,4 +116,4 @@ public sealed record SmartEmbedText : SmartText } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SmartText/SmartPlainText.cs b/src/NadekoBot/Common/SmartText/SmartPlainText.cs index 95c7f2fdc..dd67a9e99 100644 --- a/src/NadekoBot/Common/SmartText/SmartPlainText.cs +++ b/src/NadekoBot/Common/SmartText/SmartPlainText.cs @@ -1,4 +1,5 @@ -namespace NadekoBot; +#nullable disable +namespace NadekoBot; public sealed record SmartPlainText : SmartText { @@ -15,4 +16,4 @@ public sealed record SmartPlainText : SmartText public override string ToString() => Text; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SmartText/SmartText.cs b/src/NadekoBot/Common/SmartText/SmartText.cs index 4e7b725cb..61109c8c4 100644 --- a/src/NadekoBot/Common/SmartText/SmartText.cs +++ b/src/NadekoBot/Common/SmartText/SmartText.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot; @@ -55,4 +56,4 @@ public abstract record SmartText return new SmartPlainText(input); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SmartText/SmartTextEmbedAuthor.cs b/src/NadekoBot/Common/SmartText/SmartTextEmbedAuthor.cs index d208f1894..366b3747f 100644 --- a/src/NadekoBot/Common/SmartText/SmartTextEmbedAuthor.cs +++ b/src/NadekoBot/Common/SmartText/SmartTextEmbedAuthor.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot; @@ -8,4 +9,4 @@ public class SmartTextEmbedAuthor [JsonProperty("icon_url")] public string IconUrl { get; set; } public string Url { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SmartText/SmartTextEmbedField.cs b/src/NadekoBot/Common/SmartText/SmartTextEmbedField.cs index 5480479bd..04d0e476c 100644 --- a/src/NadekoBot/Common/SmartText/SmartTextEmbedField.cs +++ b/src/NadekoBot/Common/SmartText/SmartTextEmbedField.cs @@ -1,8 +1,9 @@ -namespace NadekoBot; +#nullable disable +namespace NadekoBot; public class SmartTextEmbedField { public string Name { get; set; } public string Value { get; set; } public bool Inline { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SmartText/SmartTextEmbedFooter.cs b/src/NadekoBot/Common/SmartText/SmartTextEmbedFooter.cs index 3176f3d23..0d2eff8a6 100644 --- a/src/NadekoBot/Common/SmartText/SmartTextEmbedFooter.cs +++ b/src/NadekoBot/Common/SmartText/SmartTextEmbedFooter.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot; @@ -9,4 +10,4 @@ public class SmartTextEmbedFooter public string Text { get; set; } [JsonProperty("icon_url")] public string IconUrl { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/SocketMessageEventWrapper.cs b/src/NadekoBot/Common/SocketMessageEventWrapper.cs index aafd4aa42..b07e6c745 100644 --- a/src/NadekoBot/Common/SocketMessageEventWrapper.cs +++ b/src/NadekoBot/Common/SocketMessageEventWrapper.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common; +#nullable disable +namespace NadekoBot.Common; public sealed class ReactionEventWrapper : IDisposable { @@ -93,4 +94,4 @@ public sealed class ReactionEventWrapper : IDisposable disposing = true; UnsubAll(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs b/src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs index ca4768ddf..e52b46226 100644 --- a/src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.CustomReactions.Services; +#nullable disable +using NadekoBot.Modules.CustomReactions.Services; namespace NadekoBot.Common.TypeReaders; @@ -84,4 +85,4 @@ public class CommandOrCrInfo this.Name = input; this.CmdType = type; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/EmoteTypeReader.cs b/src/NadekoBot/Common/TypeReaders/EmoteTypeReader.cs index a2198012c..3b3908f6d 100644 --- a/src/NadekoBot/Common/TypeReaders/EmoteTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/EmoteTypeReader.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.TypeReaders; +#nullable disable +namespace NadekoBot.Common.TypeReaders; public sealed class EmoteTypeReader : NadekoTypeReader { @@ -9,4 +10,4 @@ public sealed class EmoteTypeReader : NadekoTypeReader return Task.FromResult(TypeReaderResult.FromSuccess(emote)); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs b/src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs index d6799a3a9..75526728d 100644 --- a/src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Common.TypeReaders; @@ -47,4 +48,4 @@ public class GuildDateTime InputTime = inputTime; InputTimeUtc = TimeZoneInfo.ConvertTime(inputTime, Timezone, TimeZoneInfo.Utc); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/GuildTypeReader.cs b/src/NadekoBot/Common/TypeReaders/GuildTypeReader.cs index 710ea5139..2e69afab2 100644 --- a/src/NadekoBot/Common/TypeReaders/GuildTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/GuildTypeReader.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.TypeReaders; +#nullable disable +namespace NadekoBot.Common.TypeReaders; public sealed class GuildTypeReader : NadekoTypeReader { @@ -19,4 +20,4 @@ public sealed class GuildTypeReader : NadekoTypeReader return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No guild by that name or Id found")); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/KwumTypeReader.cs b/src/NadekoBot/Common/TypeReaders/KwumTypeReader.cs index bbdd046b0..5c76ca1e2 100644 --- a/src/NadekoBot/Common/TypeReaders/KwumTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/KwumTypeReader.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.TypeReaders; +#nullable disable +namespace NadekoBot.Common.TypeReaders; public sealed class KwumTypeReader : NadekoTypeReader { @@ -15,4 +16,4 @@ public sealed class SmartTextTypeReader : NadekoTypeReader { public override Task ReadAsync(ICommandContext ctx, string input) => Task.FromResult(TypeReaderResult.FromSuccess(SmartText.CreateFrom(input))); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/Models/PermissionAction.cs b/src/NadekoBot/Common/TypeReaders/Models/PermissionAction.cs index c9e5e355a..807da90bf 100644 --- a/src/NadekoBot/Common/TypeReaders/Models/PermissionAction.cs +++ b/src/NadekoBot/Common/TypeReaders/Models/PermissionAction.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.TypeReaders.Models; +#nullable disable +namespace NadekoBot.Common.TypeReaders.Models; public class PermissionAction { @@ -21,4 +22,4 @@ public class PermissionAction } public override int GetHashCode() => Value.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/Models/StoopidTime.cs b/src/NadekoBot/Common/TypeReaders/Models/StoopidTime.cs index d21c9895e..01fb506f6 100644 --- a/src/NadekoBot/Common/TypeReaders/Models/StoopidTime.cs +++ b/src/NadekoBot/Common/TypeReaders/Models/StoopidTime.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +#nullable disable +using System.Text.RegularExpressions; namespace NadekoBot.Common.TypeReaders.Models; @@ -59,4 +60,4 @@ public class StoopidTime Time = ts, }; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/ModuleTypeReader.cs b/src/NadekoBot/Common/TypeReaders/ModuleTypeReader.cs index 34204ec62..567b5469d 100644 --- a/src/NadekoBot/Common/TypeReaders/ModuleTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/ModuleTypeReader.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.TypeReaders; +#nullable disable +namespace NadekoBot.Common.TypeReaders; public sealed class ModuleTypeReader : NadekoTypeReader { @@ -44,4 +45,4 @@ public sealed class ModuleOrCrTypeReader : NadekoTypeReader public sealed class ModuleOrCrInfo { public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/NadekoTypeReader.cs b/src/NadekoBot/Common/TypeReaders/NadekoTypeReader.cs index 8a1878b3b..60e657751 100644 --- a/src/NadekoBot/Common/TypeReaders/NadekoTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/NadekoTypeReader.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.TypeReaders; +#nullable disable +namespace NadekoBot.Common.TypeReaders; [MeansImplicitUse(ImplicitUseTargetFlags.Default | ImplicitUseTargetFlags.WithInheritors )] public abstract class NadekoTypeReader : TypeReader @@ -7,4 +8,4 @@ public abstract class NadekoTypeReader : TypeReader public override Task ReadAsync(ICommandContext ctx, string input, IServiceProvider services) => ReadAsync(ctx, input); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/PermissionActionTypeReader.cs b/src/NadekoBot/Common/TypeReaders/PermissionActionTypeReader.cs index 158b6d964..d151f133a 100644 --- a/src/NadekoBot/Common/TypeReaders/PermissionActionTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/PermissionActionTypeReader.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders.Models; +#nullable disable +using NadekoBot.Common.TypeReaders.Models; namespace NadekoBot.Common.TypeReaders; @@ -34,4 +35,4 @@ public sealed class PermissionActionTypeReader : NadekoTypeReader @@ -17,4 +18,4 @@ public sealed class Rgba32TypeReader : NadekoTypeReader return TypeReaderResult.FromError(CommandError.ParseFailed, "Parameter is not a valid color hex."); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs b/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs index eec867d34..d190464a8 100644 --- a/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +#nullable disable +using System.Text.RegularExpressions; using NadekoBot.Db; using NadekoBot.Modules.Gambling.Services; @@ -96,4 +97,4 @@ public sealed class ShmartNumberTypeReader : NadekoTypeReader return false; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/TypeReaders/StoopidTimeTypeReader.cs b/src/NadekoBot/Common/TypeReaders/StoopidTimeTypeReader.cs index 3c503a1e0..9e39dcfce 100644 --- a/src/NadekoBot/Common/TypeReaders/StoopidTimeTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/StoopidTimeTypeReader.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders.Models; +#nullable disable +using NadekoBot.Common.TypeReaders.Models; namespace NadekoBot.Common.TypeReaders; @@ -18,4 +19,4 @@ public sealed class StoopidTimeTypeReader : NadekoTypeReader return Task.FromResult(TypeReaderResult.FromError(CommandError.Exception, ex.Message)); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/CommentAttribute.cs b/src/NadekoBot/Common/Yml/CommentAttribute.cs index e2a3978d1..54862d0f3 100644 --- a/src/NadekoBot/Common/Yml/CommentAttribute.cs +++ b/src/NadekoBot/Common/Yml/CommentAttribute.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.Yml; +#nullable disable +namespace NadekoBot.Common.Yml; public class CommentAttribute : Attribute { @@ -6,4 +7,4 @@ public class CommentAttribute : Attribute public CommentAttribute(string comment) => Comment = comment; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/CommentGatheringTypeInspector.cs b/src/NadekoBot/Common/Yml/CommentGatheringTypeInspector.cs index abc5e9115..19c637537 100644 --- a/src/NadekoBot/Common/Yml/CommentGatheringTypeInspector.cs +++ b/src/NadekoBot/Common/Yml/CommentGatheringTypeInspector.cs @@ -1,4 +1,5 @@ -using YamlDotNet.Core; +#nullable disable +using YamlDotNet.Core; using YamlDotNet.Serialization; using YamlDotNet.Serialization.TypeInspectors; @@ -61,4 +62,4 @@ public class CommentGatheringTypeInspector : TypeInspectorSkeleton : baseDescriptor.Read(target); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/CommentsObjectDescriptor.cs b/src/NadekoBot/Common/Yml/CommentsObjectDescriptor.cs index 672404b47..c27f4e631 100644 --- a/src/NadekoBot/Common/Yml/CommentsObjectDescriptor.cs +++ b/src/NadekoBot/Common/Yml/CommentsObjectDescriptor.cs @@ -1,4 +1,5 @@ -using YamlDotNet.Core; +#nullable disable +using YamlDotNet.Core; using YamlDotNet.Serialization; namespace NadekoBot.Common.Yml; @@ -26,4 +27,4 @@ public sealed class CommentsObjectDescriptor : IObjectDescriptor public ScalarStyle ScalarStyle => innerDescriptor.ScalarStyle; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/CommentsObjectGraphVisitor.cs b/src/NadekoBot/Common/Yml/CommentsObjectGraphVisitor.cs index 429ee1910..e9effdba2 100644 --- a/src/NadekoBot/Common/Yml/CommentsObjectGraphVisitor.cs +++ b/src/NadekoBot/Common/Yml/CommentsObjectGraphVisitor.cs @@ -1,4 +1,5 @@ -using YamlDotNet.Core; +#nullable disable +using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Serialization; using YamlDotNet.Serialization.ObjectGraphVisitors; @@ -22,4 +23,4 @@ public class CommentsObjectGraphVisitor : ChainedObjectGraphVisitor return base.EnterMapping(key, value, context); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/MultilineScalarFlowStyleEmitter.cs b/src/NadekoBot/Common/Yml/MultilineScalarFlowStyleEmitter.cs index 9a1c477b5..5e502dd3b 100644 --- a/src/NadekoBot/Common/Yml/MultilineScalarFlowStyleEmitter.cs +++ b/src/NadekoBot/Common/Yml/MultilineScalarFlowStyleEmitter.cs @@ -1,4 +1,5 @@ -using YamlDotNet.Core; +#nullable disable +using YamlDotNet.Core; using YamlDotNet.Serialization; using YamlDotNet.Serialization.EventEmitters; @@ -26,4 +27,4 @@ public class MultilineScalarFlowStyleEmitter : ChainedEventEmitter nextEmitter.Emit(eventInfo, emitter); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/Rgba32Converter.cs b/src/NadekoBot/Common/Yml/Rgba32Converter.cs index 827ad0753..53cfe3fff 100644 --- a/src/NadekoBot/Common/Yml/Rgba32Converter.cs +++ b/src/NadekoBot/Common/Yml/Rgba32Converter.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; using SixLabors.ImageSharp.PixelFormats; using YamlDotNet.Core; using YamlDotNet.Core.Events; @@ -43,4 +44,4 @@ public class CultureInfoConverter : IYamlTypeConverter var ci = (CultureInfo)value; emitter.Emit(new Scalar(ci.Name)); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/UriConverter.cs b/src/NadekoBot/Common/Yml/UriConverter.cs index a2c36282a..6488e9f3c 100644 --- a/src/NadekoBot/Common/Yml/UriConverter.cs +++ b/src/NadekoBot/Common/Yml/UriConverter.cs @@ -1,4 +1,5 @@ -using YamlDotNet.Core; +#nullable disable +using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Serialization; @@ -21,4 +22,4 @@ public class UriConverter : IYamlTypeConverter var uri = (Uri)value; emitter.Emit(new Scalar(uri.ToString())); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/Yaml.cs b/src/NadekoBot/Common/Yml/Yaml.cs index 1b50f3b39..3a9e0c043 100644 --- a/src/NadekoBot/Common/Yml/Yaml.cs +++ b/src/NadekoBot/Common/Yml/Yaml.cs @@ -1,4 +1,5 @@ -using YamlDotNet.Serialization; +#nullable disable +using YamlDotNet.Serialization; namespace NadekoBot.Common.Yml; @@ -23,4 +24,4 @@ public class Yaml .WithTypeConverter(new UriConverter()) .IgnoreUnmatchedProperties() .Build(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Common/Yml/YamlHelper.cs b/src/NadekoBot/Common/Yml/YamlHelper.cs index 2c3f0f506..39a42b609 100644 --- a/src/NadekoBot/Common/Yml/YamlHelper.cs +++ b/src/NadekoBot/Common/Yml/YamlHelper.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Common.Yml; +#nullable disable +namespace NadekoBot.Common.Yml; public class YamlHelper { @@ -52,4 +53,4 @@ public class YamlHelper return c - 'a' + 10; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/ClubExtensions.cs b/src/NadekoBot/Db/Extensions/ClubExtensions.cs index 39a47d85f..64731b651 100644 --- a/src/NadekoBot/Db/Extensions/ClubExtensions.cs +++ b/src/NadekoBot/Db/Extensions/ClubExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Db.Models; namespace NadekoBot.Db; @@ -33,4 +34,4 @@ public static class ClubExtensions public static List GetClubLeaderboardPage(this DbSet clubs, int page) => clubs.AsNoTracking().OrderByDescending(x => x.Xp).Skip(page * 9).Take(9).ToList(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/CurrencyTransactionExtensions.cs b/src/NadekoBot/Db/Extensions/CurrencyTransactionExtensions.cs index 9bf9ad5a4..8cb1f0da6 100644 --- a/src/NadekoBot/Db/Extensions/CurrencyTransactionExtensions.cs +++ b/src/NadekoBot/Db/Extensions/CurrencyTransactionExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; namespace NadekoBot.Db; @@ -13,4 +14,4 @@ public static class CurrencyTransactionExtensions .Skip(15 * page) .Take(15) .ToList(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/CustomReactionsExtensions.cs b/src/NadekoBot/Db/Extensions/CustomReactionsExtensions.cs index cdf4eec59..02c43e43d 100644 --- a/src/NadekoBot/Db/Extensions/CustomReactionsExtensions.cs +++ b/src/NadekoBot/Db/Extensions/CustomReactionsExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using LinqToDB; using NadekoBot.Services.Database.Models; @@ -14,4 +15,4 @@ public static class CustomReactionsExtensions public static CustomReaction GetByGuildIdAndInput(this DbSet crs, ulong? guildId, string input) => crs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/DbExtensions.cs b/src/NadekoBot/Db/Extensions/DbExtensions.cs index 22dfb68e9..50bc73023 100644 --- a/src/NadekoBot/Db/Extensions/DbExtensions.cs +++ b/src/NadekoBot/Db/Extensions/DbExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; namespace NadekoBot.Db; @@ -8,4 +9,4 @@ public static class DbExtensions public static T GetById(this DbSet set, int id) where T : DbEntity => set.FirstOrDefault(x => x.Id == id); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/DiscordUserExtensions.cs b/src/NadekoBot/Db/Extensions/DiscordUserExtensions.cs index 2cafc316d..da4f89864 100644 --- a/src/NadekoBot/Db/Extensions/DiscordUserExtensions.cs +++ b/src/NadekoBot/Db/Extensions/DiscordUserExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Db.Models; +#nullable disable +using NadekoBot.Db.Models; using Microsoft.EntityFrameworkCore; using LinqToDB; using LinqToDB.EntityFrameworkCore; @@ -185,4 +186,4 @@ VALUES ({userId}, {name}, {discrim}, {avatarId}, {amount}, 0); .OrderByDescending(x => x.CurrencyAmount) .Take(users.Count() / 100 == 0 ? 1 : users.Count() / 100) .Sum(x => x.CurrencyAmount); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/GuildConfigExtensions.cs b/src/NadekoBot/Db/Extensions/GuildConfigExtensions.cs index d7dbbf024..d756fd1b1 100644 --- a/src/NadekoBot/Db/Extensions/GuildConfigExtensions.cs +++ b/src/NadekoBot/Db/Extensions/GuildConfigExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database; using NadekoBot.Db.Models; @@ -201,4 +202,4 @@ public static class GuildConfigExtensions .SelectMany(x => x.GenerateCurrencyChannelIds) .Select(x => new GeneratingChannel() { ChannelId = x.ChannelId, GuildId = x.GuildConfig.GuildId }) .ToArray(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/MusicPlayerSettingsExtensions.cs b/src/NadekoBot/Db/Extensions/MusicPlayerSettingsExtensions.cs index ba98938df..8f3ec8910 100644 --- a/src/NadekoBot/Db/Extensions/MusicPlayerSettingsExtensions.cs +++ b/src/NadekoBot/Db/Extensions/MusicPlayerSettingsExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; namespace NadekoBot.Db; @@ -20,4 +21,4 @@ public static class MusicPlayerSettingsExtensions return toReturn; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/MusicPlaylistExtensions.cs b/src/NadekoBot/Db/Extensions/MusicPlaylistExtensions.cs index 40cd3cd9c..bcb9a8e37 100644 --- a/src/NadekoBot/Db/Extensions/MusicPlaylistExtensions.cs +++ b/src/NadekoBot/Db/Extensions/MusicPlaylistExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; namespace NadekoBot.Db; @@ -20,4 +21,4 @@ public static class MusicPlaylistExtensions public static MusicPlaylist GetWithSongs(this DbSet playlists, int id) => playlists.Include(mpl => mpl.Songs) .FirstOrDefault(mpl => mpl.Id == id); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/PollExtensions.cs b/src/NadekoBot/Db/Extensions/PollExtensions.cs index 58fbd6e4d..b0fd2d41d 100644 --- a/src/NadekoBot/Db/Extensions/PollExtensions.cs +++ b/src/NadekoBot/Db/Extensions/PollExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; @@ -34,4 +35,4 @@ public static class PollExtensions ctx.Poll.Remove(p); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/QuoteExtensions.cs b/src/NadekoBot/Db/Extensions/QuoteExtensions.cs index b2edb003d..717cd135b 100644 --- a/src/NadekoBot/Db/Extensions/QuoteExtensions.cs +++ b/src/NadekoBot/Db/Extensions/QuoteExtensions.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; @@ -60,4 +61,4 @@ public static class QuoteExtensions => quotes.RemoveRange(quotes.AsQueryable() .Where(x => x.GuildId == guildId && x.Keyword.ToUpper() == keyword) ); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/ReminderExtensions.cs b/src/NadekoBot/Db/Extensions/ReminderExtensions.cs index f1cb13060..2deccecb8 100644 --- a/src/NadekoBot/Db/Extensions/ReminderExtensions.cs +++ b/src/NadekoBot/Db/Extensions/ReminderExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; namespace NadekoBot.Db; @@ -25,4 +26,4 @@ public static class ReminderExtensions .OrderBy(x => x.DateAdded) .Skip(page * 10) .Take(10); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/SelfAssignableRolesExtensions.cs b/src/NadekoBot/Db/Extensions/SelfAssignableRolesExtensions.cs index a0a455c30..d49b0df35 100644 --- a/src/NadekoBot/Db/Extensions/SelfAssignableRolesExtensions.cs +++ b/src/NadekoBot/Db/Extensions/SelfAssignableRolesExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; namespace NadekoBot.Db; @@ -20,4 +21,4 @@ public static class SelfAssignableRolesExtensions => roles.AsQueryable() .Where(s => s.GuildId == guildId) .ToArray(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/UserXpExtensions.cs b/src/NadekoBot/Db/Extensions/UserXpExtensions.cs index 4d73f5f0a..beffcba56 100644 --- a/src/NadekoBot/Db/Extensions/UserXpExtensions.cs +++ b/src/NadekoBot/Db/Extensions/UserXpExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using LinqToDB; using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; @@ -64,4 +65,4 @@ public static class UserXpExtensions public static void ResetGuildXp(this DbSet xps, ulong guildId) => xps.Delete(x => x.GuildId == guildId); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/WaifuExtensions.cs b/src/NadekoBot/Db/Extensions/WaifuExtensions.cs index 8d8cf38e2..ce017ecf5 100644 --- a/src/NadekoBot/Db/Extensions/WaifuExtensions.cs +++ b/src/NadekoBot/Db/Extensions/WaifuExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; using NadekoBot.Db.Models; @@ -143,4 +144,4 @@ VALUES ({null}, {null}, {1}, (SELECT Id FROM DiscordUser WHERE UserId={userId})) return toReturn; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Extensions/WarningExtensions.cs b/src/NadekoBot/Db/Extensions/WarningExtensions.cs index e0b33b471..c3d00f04e 100644 --- a/src/NadekoBot/Db/Extensions/WarningExtensions.cs +++ b/src/NadekoBot/Db/Extensions/WarningExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; namespace NadekoBot.Db; @@ -60,4 +61,4 @@ public static class WarningExtensions => warnings.AsQueryable() .Where(x => x.GuildId == id) .ToArray(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/AntiProtection.cs b/src/NadekoBot/Db/Models/AntiProtection.cs index 2aaeb422b..aed73ef4b 100644 --- a/src/NadekoBot/Db/Models/AntiProtection.cs +++ b/src/NadekoBot/Db/Models/AntiProtection.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class AntiRaidSetting : DbEntity { @@ -60,4 +61,4 @@ public class AntiSpamIgnore : DbEntity => obj is AntiSpamIgnore inst ? inst.ChannelId == ChannelId : false; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/AutoCommand.cs b/src/NadekoBot/Db/Models/AutoCommand.cs index c527e3215..75cc27041 100644 --- a/src/NadekoBot/Db/Models/AutoCommand.cs +++ b/src/NadekoBot/Db/Models/AutoCommand.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class AutoCommand : DbEntity { @@ -10,4 +11,4 @@ public class AutoCommand : DbEntity public ulong? VoiceChannelId {get; set; } public string VoiceChannelName { get; set; } public int Interval { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/AutoTranslateChannel.cs b/src/NadekoBot/Db/Models/AutoTranslateChannel.cs index 8b97d6454..3107a3e02 100644 --- a/src/NadekoBot/Db/Models/AutoTranslateChannel.cs +++ b/src/NadekoBot/Db/Models/AutoTranslateChannel.cs @@ -1,3 +1,4 @@ +#nullable disable namespace NadekoBot.Services.Database.Models; public class AutoTranslateChannel : DbEntity @@ -6,4 +7,4 @@ public class AutoTranslateChannel : DbEntity public ulong ChannelId { get; set; } public bool AutoDelete { get; set; } public IList Users { get; set; } = new List(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/AutoTranslateUser.cs b/src/NadekoBot/Db/Models/AutoTranslateUser.cs index 7b3db6aef..03f061543 100644 --- a/src/NadekoBot/Db/Models/AutoTranslateUser.cs +++ b/src/NadekoBot/Db/Models/AutoTranslateUser.cs @@ -1,3 +1,4 @@ +#nullable disable namespace NadekoBot.Services.Database.Models; public class AutoTranslateUser : DbEntity @@ -7,4 +8,4 @@ public class AutoTranslateUser : DbEntity public ulong UserId { get; set; } public string Source { get; set; } public string Target { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/BanTemplate.cs b/src/NadekoBot/Db/Models/BanTemplate.cs index 19d7d60e0..0b3415953 100644 --- a/src/NadekoBot/Db/Models/BanTemplate.cs +++ b/src/NadekoBot/Db/Models/BanTemplate.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class BanTemplate : DbEntity { public ulong GuildId { get; set; } public string Text { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/BlacklistEntry.cs b/src/NadekoBot/Db/Models/BlacklistEntry.cs index 80e6ac5ea..ff7958cd0 100644 --- a/src/NadekoBot/Db/Models/BlacklistEntry.cs +++ b/src/NadekoBot/Db/Models/BlacklistEntry.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class BlacklistEntry : DbEntity { @@ -11,4 +12,4 @@ public enum BlacklistType Server, Channel, User -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/ClubInfo.cs b/src/NadekoBot/Db/Models/ClubInfo.cs index 0e3144212..e787eda2a 100644 --- a/src/NadekoBot/Db/Models/ClubInfo.cs +++ b/src/NadekoBot/Db/Models/ClubInfo.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +#nullable disable +using System.ComponentModel.DataAnnotations; using NadekoBot.Services.Database.Models; namespace NadekoBot.Db.Models; @@ -42,4 +43,4 @@ public class ClubBans public int UserId { get; set; } public DiscordUser User { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/CommandAlias.cs b/src/NadekoBot/Db/Models/CommandAlias.cs index 89ed8943c..f94be8afd 100644 --- a/src/NadekoBot/Db/Models/CommandAlias.cs +++ b/src/NadekoBot/Db/Models/CommandAlias.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class CommandAlias : DbEntity { public string Trigger { get; set; } public string Mapping { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/CommandCooldown.cs b/src/NadekoBot/Db/Models/CommandCooldown.cs index eaf603526..5854f0cdd 100644 --- a/src/NadekoBot/Db/Models/CommandCooldown.cs +++ b/src/NadekoBot/Db/Models/CommandCooldown.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class CommandCooldown : DbEntity { public int Seconds { get; set; } public string CommandName { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/CurrencyTransaction.cs b/src/NadekoBot/Db/Models/CurrencyTransaction.cs index 3e31af27d..76cdf42a2 100644 --- a/src/NadekoBot/Db/Models/CurrencyTransaction.cs +++ b/src/NadekoBot/Db/Models/CurrencyTransaction.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class CurrencyTransaction : DbEntity { @@ -12,4 +13,4 @@ public class CurrencyTransaction : DbEntity Reason = Reason, UserId = UserId, }; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/CustomReaction.cs b/src/NadekoBot/Db/Models/CustomReaction.cs index 7c63f0782..bf689d657 100644 --- a/src/NadekoBot/Db/Models/CustomReaction.cs +++ b/src/NadekoBot/Db/Models/CustomReaction.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class CustomReaction : DbEntity { @@ -24,4 +25,4 @@ public class ReactionResponse : DbEntity { public bool OwnerOnly { get; set; } public string Text { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/DbEntity.cs b/src/NadekoBot/Db/Models/DbEntity.cs index 04221b89c..c255fdc3c 100644 --- a/src/NadekoBot/Db/Models/DbEntity.cs +++ b/src/NadekoBot/Db/Models/DbEntity.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +#nullable disable +using System.ComponentModel.DataAnnotations; namespace NadekoBot.Services.Database.Models; @@ -7,4 +8,4 @@ public class DbEntity [Key] public int Id { get; set; } public DateTime? DateAdded { get; set; } = DateTime.UtcNow; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/DelMsgOnCmdChannel.cs b/src/NadekoBot/Db/Models/DelMsgOnCmdChannel.cs index 8378f9251..a77180f81 100644 --- a/src/NadekoBot/Db/Models/DelMsgOnCmdChannel.cs +++ b/src/NadekoBot/Db/Models/DelMsgOnCmdChannel.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class DelMsgOnCmdChannel : DbEntity { @@ -11,4 +12,4 @@ public class DelMsgOnCmdChannel : DbEntity public override bool Equals(object obj) => obj is DelMsgOnCmdChannel x && x.ChannelId == ChannelId; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/DiscordPemOverride.cs b/src/NadekoBot/Db/Models/DiscordPemOverride.cs index a7fbf10bd..e8dd9c489 100644 --- a/src/NadekoBot/Db/Models/DiscordPemOverride.cs +++ b/src/NadekoBot/Db/Models/DiscordPemOverride.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class DiscordPermOverride : DbEntity { @@ -6,4 +7,4 @@ public class DiscordPermOverride : DbEntity public ulong? GuildId { get; set; } public string Command { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/DiscordUser.cs b/src/NadekoBot/Db/Models/DiscordUser.cs index 33cf66df9..cfdf76ff7 100644 --- a/src/NadekoBot/Db/Models/DiscordUser.cs +++ b/src/NadekoBot/Db/Models/DiscordUser.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Db.Models; @@ -29,4 +30,4 @@ public class DiscordUser : DbEntity public override string ToString() => Username + "#" + Discriminator; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Event.cs b/src/NadekoBot/Db/Models/Event.cs index 126892e10..cc5bbfe5b 100644 --- a/src/NadekoBot/Db/Models/Event.cs +++ b/src/NadekoBot/Db/Models/Event.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class CurrencyEvent { @@ -41,4 +42,4 @@ public class CurrencyEvent public class AwardedUser { -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/FeedSub.cs b/src/NadekoBot/Db/Models/FeedSub.cs index 55f83c1d0..cc65945ca 100644 --- a/src/NadekoBot/Db/Models/FeedSub.cs +++ b/src/NadekoBot/Db/Models/FeedSub.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class FeedSub : DbEntity { @@ -15,4 +16,4 @@ public class FeedSub : DbEntity => obj is FeedSub s && s.Url.ToLower() == Url.ToLower() && s.GuildConfigId == GuildConfigId; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/FilterChannelId.cs b/src/NadekoBot/Db/Models/FilterChannelId.cs index 58907525c..51ce27ca2 100644 --- a/src/NadekoBot/Db/Models/FilterChannelId.cs +++ b/src/NadekoBot/Db/Models/FilterChannelId.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class FilterChannelId : DbEntity { @@ -26,4 +27,4 @@ public class FilterInvitesChannelId : DbEntity public override int GetHashCode() => ChannelId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/FilterLinksChannelId.cs b/src/NadekoBot/Db/Models/FilterLinksChannelId.cs index 469baf233..d39320871 100644 --- a/src/NadekoBot/Db/Models/FilterLinksChannelId.cs +++ b/src/NadekoBot/Db/Models/FilterLinksChannelId.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class FilterLinksChannelId : DbEntity { @@ -10,4 +11,4 @@ public class FilterLinksChannelId : DbEntity public override int GetHashCode() => ChannelId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/FilteredWord.cs b/src/NadekoBot/Db/Models/FilteredWord.cs index 5e2bbd6bc..bfdd166c5 100644 --- a/src/NadekoBot/Db/Models/FilteredWord.cs +++ b/src/NadekoBot/Db/Models/FilteredWord.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class FilteredWord : DbEntity { public string Word { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/FollowedStream.cs b/src/NadekoBot/Db/Models/FollowedStream.cs index b197422f3..14472d875 100644 --- a/src/NadekoBot/Db/Models/FollowedStream.cs +++ b/src/NadekoBot/Db/Models/FollowedStream.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Searches.Common; namespace NadekoBot.Db.Models; @@ -31,4 +32,4 @@ public class FollowedStream : DbEntity => obj is FollowedStream fs && Equals(fs); public StreamDataKey CreateKey() => new(Type, Username.ToLower()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/GCChannelId.cs b/src/NadekoBot/Db/Models/GCChannelId.cs index 8c3ebc017..077d4165e 100644 --- a/src/NadekoBot/Db/Models/GCChannelId.cs +++ b/src/NadekoBot/Db/Models/GCChannelId.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class GCChannelId : DbEntity { @@ -12,4 +13,4 @@ public class GCChannelId : DbEntity public override int GetHashCode() => this.ChannelId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/GroupName.cs b/src/NadekoBot/Db/Models/GroupName.cs index a04ce6b9a..e1b84e3d4 100644 --- a/src/NadekoBot/Db/Models/GroupName.cs +++ b/src/NadekoBot/Db/Models/GroupName.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class GroupName : DbEntity { @@ -7,4 +8,4 @@ public class GroupName : DbEntity public int Number { get; set; } public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/GuildConfig.cs b/src/NadekoBot/Db/Models/GuildConfig.cs index b90789af1..825e7301a 100644 --- a/src/NadekoBot/Db/Models/GuildConfig.cs +++ b/src/NadekoBot/Db/Models/GuildConfig.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Collections; +#nullable disable +using NadekoBot.Common.Collections; using NadekoBot.Db.Models; namespace NadekoBot.Services.Database.Models; @@ -103,4 +104,4 @@ public class GuildConfig : DbEntity public List SelfAssignableRoleGroupNames { get; set; } public int WarnExpireHours { get; set; } = 0; public WarnExpireAction WarnExpireAction { get; set; } = WarnExpireAction.Clear; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/IgnoredLogItem.cs b/src/NadekoBot/Db/Models/IgnoredLogItem.cs index b9b721bb8..415827436 100644 --- a/src/NadekoBot/Db/Models/IgnoredLogItem.cs +++ b/src/NadekoBot/Db/Models/IgnoredLogItem.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class IgnoredLogItem : DbEntity { @@ -12,4 +13,4 @@ public enum IgnoredItemType { Channel, User, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/IgnoredVoicePresenceChannel.cs b/src/NadekoBot/Db/Models/IgnoredVoicePresenceChannel.cs index c733e19a6..396276bd6 100644 --- a/src/NadekoBot/Db/Models/IgnoredVoicePresenceChannel.cs +++ b/src/NadekoBot/Db/Models/IgnoredVoicePresenceChannel.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class IgnoredVoicePresenceChannel : DbEntity { public LogSetting LogSetting { get; set; } public ulong ChannelId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/ImageOnlyChannel.cs b/src/NadekoBot/Db/Models/ImageOnlyChannel.cs index 6155685af..5a4ae6909 100644 --- a/src/NadekoBot/Db/Models/ImageOnlyChannel.cs +++ b/src/NadekoBot/Db/Models/ImageOnlyChannel.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class ImageOnlyChannel : DbEntity { public ulong GuildId { get; set; } public ulong ChannelId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/LogSetting.cs b/src/NadekoBot/Db/Models/LogSetting.cs index 46b4237e4..4e2988419 100644 --- a/src/NadekoBot/Db/Models/LogSetting.cs +++ b/src/NadekoBot/Db/Models/LogSetting.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class LogSetting : DbEntity { @@ -28,4 +29,4 @@ public class LogSetting : DbEntity public ulong? LogVoicePresenceId { get; set; } public ulong? LogVoicePresenceTTSId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/MusicPlaylist.cs b/src/NadekoBot/Db/Models/MusicPlaylist.cs index 6543833d2..b8804d34c 100644 --- a/src/NadekoBot/Db/Models/MusicPlaylist.cs +++ b/src/NadekoBot/Db/Models/MusicPlaylist.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class MusicPlaylist : DbEntity { @@ -6,4 +7,4 @@ public class MusicPlaylist : DbEntity public string Author { get; set; } public ulong AuthorId { get; set; } public List Songs { get; set; } = new(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/MusicSettings.cs b/src/NadekoBot/Db/Models/MusicSettings.cs index 6a22899cb..b1e19452d 100644 --- a/src/NadekoBot/Db/Models/MusicSettings.cs +++ b/src/NadekoBot/Db/Models/MusicSettings.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class MusicPlayerSettings { @@ -52,4 +53,4 @@ public enum PlayerRepeatType None, Track, Queue -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/MutedUserId.cs b/src/NadekoBot/Db/Models/MutedUserId.cs index 026788967..556584455 100644 --- a/src/NadekoBot/Db/Models/MutedUserId.cs +++ b/src/NadekoBot/Db/Models/MutedUserId.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class MutedUserId : DbEntity { @@ -11,4 +12,4 @@ public class MutedUserId : DbEntity => obj is MutedUserId mui ? mui.UserId == UserId : false; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/NsfwBlacklistedTag.cs b/src/NadekoBot/Db/Models/NsfwBlacklistedTag.cs index 29a4f83ec..51d7946bd 100644 --- a/src/NadekoBot/Db/Models/NsfwBlacklistedTag.cs +++ b/src/NadekoBot/Db/Models/NsfwBlacklistedTag.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class NsfwBlacklistedTag : DbEntity { @@ -10,4 +11,4 @@ public class NsfwBlacklistedTag : DbEntity public override bool Equals(object obj) => obj is NsfwBlacklistedTag x && x.Tag == Tag; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Permission.cs b/src/NadekoBot/Db/Models/Permission.cs index 6680ca1f3..615ec1e00 100644 --- a/src/NadekoBot/Db/Models/Permission.cs +++ b/src/NadekoBot/Db/Models/Permission.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations.Schema; +#nullable disable +using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics; namespace NadekoBot.Services.Database.Models; @@ -55,4 +56,4 @@ public enum SecondaryPermissionType Module, Command, AllModules -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/PlantedCurrency.cs b/src/NadekoBot/Db/Models/PlantedCurrency.cs index d7f07ba4e..b2b3e1dc5 100644 --- a/src/NadekoBot/Db/Models/PlantedCurrency.cs +++ b/src/NadekoBot/Db/Models/PlantedCurrency.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class PlantedCurrency : DbEntity { @@ -8,4 +9,4 @@ public class PlantedCurrency : DbEntity public ulong ChannelId { get; set; } public ulong UserId { get; set; } public ulong MessageId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/PlaylistSong.cs b/src/NadekoBot/Db/Models/PlaylistSong.cs index 5495b402c..399b97214 100644 --- a/src/NadekoBot/Db/Models/PlaylistSong.cs +++ b/src/NadekoBot/Db/Models/PlaylistSong.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class PlaylistSong : DbEntity { @@ -15,4 +16,4 @@ public enum MusicType YouTube, Local, Soundcloud -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Poll.cs b/src/NadekoBot/Db/Models/Poll.cs index f2216d4ae..69a2a6e4e 100644 --- a/src/NadekoBot/Db/Models/Poll.cs +++ b/src/NadekoBot/Db/Models/Poll.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Collections; +#nullable disable +using NadekoBot.Common.Collections; namespace NadekoBot.Services.Database.Models; @@ -15,4 +16,4 @@ public class PollAnswer : DbEntity, IIndexed { public int Index { get; set; } public string Text { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/PollVote.cs b/src/NadekoBot/Db/Models/PollVote.cs index 4523bde5b..06a21dd90 100644 --- a/src/NadekoBot/Db/Models/PollVote.cs +++ b/src/NadekoBot/Db/Models/PollVote.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class PollVote : DbEntity { @@ -12,4 +13,4 @@ public class PollVote : DbEntity => obj is PollVote p ? p.UserId == UserId : false; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Quote.cs b/src/NadekoBot/Db/Models/Quote.cs index 47396b5ce..53906228b 100644 --- a/src/NadekoBot/Db/Models/Quote.cs +++ b/src/NadekoBot/Db/Models/Quote.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +#nullable disable +using System.ComponentModel.DataAnnotations; namespace NadekoBot.Services.Database.Models; @@ -19,4 +20,4 @@ public enum OrderType { Id = -1, Keyword = -2 -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/ReactionRole.cs b/src/NadekoBot/Db/Models/ReactionRole.cs index 0406cf98b..a2ad1a768 100644 --- a/src/NadekoBot/Db/Models/ReactionRole.cs +++ b/src/NadekoBot/Db/Models/ReactionRole.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class ReactionRoleMessage : DbEntity, IIndexed { @@ -18,4 +19,4 @@ public class ReactionRole : DbEntity { public string EmoteName { get; set; } public ulong RoleId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Reminder.cs b/src/NadekoBot/Db/Models/Reminder.cs index 32bd90e6c..0d2a7cf1d 100644 --- a/src/NadekoBot/Db/Models/Reminder.cs +++ b/src/NadekoBot/Db/Models/Reminder.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class Reminder : DbEntity { @@ -8,4 +9,4 @@ public class Reminder : DbEntity public ulong UserId { get; set; } public string Message { get; set; } public bool IsPrivate { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Repeater.cs b/src/NadekoBot/Db/Models/Repeater.cs index 8f7fb9daf..d61dc7b07 100644 --- a/src/NadekoBot/Db/Models/Repeater.cs +++ b/src/NadekoBot/Db/Models/Repeater.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class Repeater { @@ -11,4 +12,4 @@ public class Repeater public TimeSpan? StartTimeOfDay { get; set; } public bool NoRedundant { get; set; } public DateTime DateAdded { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/RewardedUser.cs b/src/NadekoBot/Db/Models/RewardedUser.cs index 7241284d6..dbad7268d 100644 --- a/src/NadekoBot/Db/Models/RewardedUser.cs +++ b/src/NadekoBot/Db/Models/RewardedUser.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class RewardedUser : DbEntity { @@ -6,4 +7,4 @@ public class RewardedUser : DbEntity public string PatreonUserId { get; set; } public int AmountRewardedThisMonth { get; set; } public DateTime LastReward { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/RotatingPlayingStatus.cs b/src/NadekoBot/Db/Models/RotatingPlayingStatus.cs index bffeddffe..cce017d32 100644 --- a/src/NadekoBot/Db/Models/RotatingPlayingStatus.cs +++ b/src/NadekoBot/Db/Models/RotatingPlayingStatus.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class RotatingPlayingStatus : DbEntity { public string Status { get; set; } public ActivityType Type { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/SelfAssignableRole.cs b/src/NadekoBot/Db/Models/SelfAssignableRole.cs index 99b9ca279..0218596fa 100644 --- a/src/NadekoBot/Db/Models/SelfAssignableRole.cs +++ b/src/NadekoBot/Db/Models/SelfAssignableRole.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class SelfAssignedRole : DbEntity { @@ -7,4 +8,4 @@ public class SelfAssignedRole : DbEntity public int Group { get; set; } public int LevelRequirement { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/ShopEntry.cs b/src/NadekoBot/Db/Models/ShopEntry.cs index 64339aa58..44d3533b5 100644 --- a/src/NadekoBot/Db/Models/ShopEntry.cs +++ b/src/NadekoBot/Db/Models/ShopEntry.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public enum ShopEntryType { @@ -39,4 +40,4 @@ public class ShopEntryItem : DbEntity public override int GetHashCode() => Text.GetHashCode(StringComparison.InvariantCulture); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/SlowmodeIgnoredRole.cs b/src/NadekoBot/Db/Models/SlowmodeIgnoredRole.cs index 66c592af0..8463f74ae 100644 --- a/src/NadekoBot/Db/Models/SlowmodeIgnoredRole.cs +++ b/src/NadekoBot/Db/Models/SlowmodeIgnoredRole.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class SlowmodeIgnoredRole : DbEntity { @@ -18,4 +19,4 @@ public class SlowmodeIgnoredRole : DbEntity // override object.GetHashCode public override int GetHashCode() => RoleId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/SlowmodeIgnoredUser.cs b/src/NadekoBot/Db/Models/SlowmodeIgnoredUser.cs index 1485c9b27..af65ec70f 100644 --- a/src/NadekoBot/Db/Models/SlowmodeIgnoredUser.cs +++ b/src/NadekoBot/Db/Models/SlowmodeIgnoredUser.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class SlowmodeIgnoredUser : DbEntity { @@ -18,4 +19,4 @@ public class SlowmodeIgnoredUser : DbEntity // override object.GetHashCode public override int GetHashCode() => UserId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/StreamRoleSettings.cs b/src/NadekoBot/Db/Models/StreamRoleSettings.cs index 2af01625b..25387de32 100644 --- a/src/NadekoBot/Db/Models/StreamRoleSettings.cs +++ b/src/NadekoBot/Db/Models/StreamRoleSettings.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class StreamRoleSettings : DbEntity { @@ -66,4 +67,4 @@ public class StreamRoleWhitelistedUser : DbEntity public override int GetHashCode() => UserId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/UnbanTimer.cs b/src/NadekoBot/Db/Models/UnbanTimer.cs index af2f58118..c7ea97573 100644 --- a/src/NadekoBot/Db/Models/UnbanTimer.cs +++ b/src/NadekoBot/Db/Models/UnbanTimer.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class UnbanTimer : DbEntity { @@ -12,4 +13,4 @@ public class UnbanTimer : DbEntity => obj is UnbanTimer ut ? ut.UserId == UserId : false; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/UnmuteTimer.cs b/src/NadekoBot/Db/Models/UnmuteTimer.cs index d679759e4..64af55b6a 100644 --- a/src/NadekoBot/Db/Models/UnmuteTimer.cs +++ b/src/NadekoBot/Db/Models/UnmuteTimer.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class UnmuteTimer : DbEntity { @@ -12,4 +13,4 @@ public class UnmuteTimer : DbEntity => obj is UnmuteTimer ut ? ut.UserId == UserId : false; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/UnroleTimer.cs b/src/NadekoBot/Db/Models/UnroleTimer.cs index 1586cf88b..3bf30d7ed 100644 --- a/src/NadekoBot/Db/Models/UnroleTimer.cs +++ b/src/NadekoBot/Db/Models/UnroleTimer.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class UnroleTimer : DbEntity { @@ -13,4 +14,4 @@ public class UnroleTimer : DbEntity => obj is UnroleTimer ut ? ut.UserId == UserId && ut.RoleId == RoleId : false; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/UserXpStats.cs b/src/NadekoBot/Db/Models/UserXpStats.cs index 3f5654bfe..84c5c46ab 100644 --- a/src/NadekoBot/Db/Models/UserXpStats.cs +++ b/src/NadekoBot/Db/Models/UserXpStats.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class UserXpStats : DbEntity { @@ -10,4 +11,4 @@ public class UserXpStats : DbEntity public DateTime LastLevelUp { get; set; } = DateTime.UtcNow; } -public enum XpNotificationLocation { None, Dm, Channel } \ No newline at end of file +public enum XpNotificationLocation { None, Dm, Channel } diff --git a/src/NadekoBot/Db/Models/VcRoleInfo.cs b/src/NadekoBot/Db/Models/VcRoleInfo.cs index 4ff3d23a9..8a1c2d442 100644 --- a/src/NadekoBot/Db/Models/VcRoleInfo.cs +++ b/src/NadekoBot/Db/Models/VcRoleInfo.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class VcRoleInfo : DbEntity { public ulong VoiceChannelId { get; set; } public ulong RoleId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Waifu.cs b/src/NadekoBot/Db/Models/Waifu.cs index 712658538..4947b3a86 100644 --- a/src/NadekoBot/Db/Models/Waifu.cs +++ b/src/NadekoBot/Db/Models/Waifu.cs @@ -1,4 +1,5 @@ -using NadekoBot.Db.Models; +#nullable disable +using NadekoBot.Db.Models; namespace NadekoBot.Services.Database.Models; @@ -83,4 +84,4 @@ public class WaifuLbResult } return $"**{waifuUsername}#{Discrim}** - claimed by **{claimer}**\n\t{status}"; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/WaifuItem.cs b/src/NadekoBot/Db/Models/WaifuItem.cs index 2e37ff42f..a2fa14794 100644 --- a/src/NadekoBot/Db/Models/WaifuItem.cs +++ b/src/NadekoBot/Db/Models/WaifuItem.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class WaifuItem : DbEntity { public int? WaifuInfoId { get; set; } public string ItemEmoji { get; set; } public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/WaifuUpdate.cs b/src/NadekoBot/Db/Models/WaifuUpdate.cs index 4e66453f1..d1dfe5fec 100644 --- a/src/NadekoBot/Db/Models/WaifuUpdate.cs +++ b/src/NadekoBot/Db/Models/WaifuUpdate.cs @@ -1,4 +1,5 @@ -using NadekoBot.Db.Models; +#nullable disable +using NadekoBot.Db.Models; namespace NadekoBot.Services.Database.Models; @@ -19,4 +20,4 @@ public enum WaifuUpdateType { AffinityChanged, Claimed -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/WarnExpireAction.cs b/src/NadekoBot/Db/Models/WarnExpireAction.cs index 282c8afe9..d185cb7f5 100644 --- a/src/NadekoBot/Db/Models/WarnExpireAction.cs +++ b/src/NadekoBot/Db/Models/WarnExpireAction.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public enum WarnExpireAction { Clear, Delete -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/Warning.cs b/src/NadekoBot/Db/Models/Warning.cs index 2bfb6ee2b..6a9982963 100644 --- a/src/NadekoBot/Db/Models/Warning.cs +++ b/src/NadekoBot/Db/Models/Warning.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class Warning : DbEntity { @@ -9,4 +10,4 @@ public class Warning : DbEntity public string ForgivenBy { get; set; } public string Moderator { get; set; } public int Weight { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/WarningPunishment.cs b/src/NadekoBot/Db/Models/WarningPunishment.cs index 6cb1035fa..d8f502ce0 100644 --- a/src/NadekoBot/Db/Models/WarningPunishment.cs +++ b/src/NadekoBot/Db/Models/WarningPunishment.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class WarningPunishment : DbEntity { @@ -6,4 +7,4 @@ public class WarningPunishment : DbEntity public PunishmentAction Punishment { get; set; } public int Time { get; set; } public ulong? RoleId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/Models/XpSettings.cs b/src/NadekoBot/Db/Models/XpSettings.cs index 532538125..ae2d9608e 100644 --- a/src/NadekoBot/Db/Models/XpSettings.cs +++ b/src/NadekoBot/Db/Models/XpSettings.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services.Database.Models; +#nullable disable +namespace NadekoBot.Services.Database.Models; public class XpSettings : DbEntity { @@ -58,4 +59,4 @@ public class ExcludedItem : DbEntity public override bool Equals(object obj) => obj is ExcludedItem ei && ei.ItemId == ItemId && ei.ItemType == ItemType; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Db/NadekoContext.cs b/src/NadekoBot/Db/NadekoContext.cs index c1c3a0df3..e7c7ff49c 100644 --- a/src/NadekoBot/Db/NadekoContext.cs +++ b/src/NadekoBot/Db/NadekoContext.cs @@ -1,4 +1,5 @@ -using Microsoft.Data.Sqlite; +#nullable disable +using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using NadekoBot.Services.Database.Models; @@ -381,4 +382,4 @@ public class NadekoContext : DbContext modelBuilder.Entity(atu => atu .HasAlternateKey(x => new { x.ChannelId, x.UserId })); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/GlobalUsings.cs b/src/NadekoBot/GlobalUsings.cs index 8ea69a8f5..e330cb5ee 100644 --- a/src/NadekoBot/GlobalUsings.cs +++ b/src/NadekoBot/GlobalUsings.cs @@ -1,4 +1,4 @@ -global using Serilog; +global using Serilog; global using Humanizer; global using NadekoBot; @@ -20,4 +20,4 @@ global using LeftoverAttribute = Discord.Commands.RemainderAttribute; global using System.Collections.Concurrent; -global using JetBrains.Annotations; \ No newline at end of file +global using JetBrains.Annotations; diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index db5dc4f81..9c3c5f7e5 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Common.TypeReaders.Models; using NadekoBot.Modules.Administration.Services; @@ -218,7 +219,7 @@ public partial class Administration : NadekoModule public async Task SetTopic([Leftover] string topic = null) { var channel = (ITextChannel) ctx.Channel; - topic = topic ?? ""; + topic ??= ""; await channel.ModifyAsync(c => c.Topic = topic).ConfigureAwait(false); await ReplyConfirmLocalizedAsync(strs.set_topic).ConfigureAwait(false); } @@ -337,4 +338,4 @@ public partial class Administration : NadekoModule await ctx.OkAsync(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/AutoAssignRoleCommands.cs b/src/NadekoBot/Modules/Administration/AutoAssignRoleCommands.cs index d0e55a05a..39f366017 100644 --- a/src/NadekoBot/Modules/Administration/AutoAssignRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/AutoAssignRoleCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -64,4 +65,4 @@ public partial class Administration .Join(",\n"))); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Common/LogType.cs b/src/NadekoBot/Modules/Administration/Common/LogType.cs index 459d38d8d..e79c48087 100644 --- a/src/NadekoBot/Modules/Administration/Common/LogType.cs +++ b/src/NadekoBot/Modules/Administration/Common/LogType.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Administration; +#nullable disable +namespace NadekoBot.Modules.Administration; public enum LogType { @@ -17,4 +18,4 @@ public enum LogType VoicePresence, VoicePresenceTTS, UserMuted -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Common/ProtectionStats.cs b/src/NadekoBot/Modules/Administration/Common/ProtectionStats.cs index 16838b974..c70695afd 100644 --- a/src/NadekoBot/Modules/Administration/Common/ProtectionStats.cs +++ b/src/NadekoBot/Modules/Administration/Common/ProtectionStats.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Administration.Common; @@ -38,4 +39,4 @@ public class AntiAltStats public void Increment() => Interlocked.Increment(ref _counter); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Common/PunishQueueItem.cs b/src/NadekoBot/Modules/Administration/Common/PunishQueueItem.cs index 0b1d0fcae..87f6c5cab 100644 --- a/src/NadekoBot/Modules/Administration/Common/PunishQueueItem.cs +++ b/src/NadekoBot/Modules/Administration/Common/PunishQueueItem.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Administration.Common; @@ -9,4 +10,4 @@ public class PunishQueueItem public int MuteTime { get; set; } public ulong? RoleId { get; set; } public IGuildUser User { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Common/UserSpamStats.cs b/src/NadekoBot/Modules/Administration/Common/UserSpamStats.cs index a0521f350..14aa8b0ad 100644 --- a/src/NadekoBot/Modules/Administration/Common/UserSpamStats.cs +++ b/src/NadekoBot/Modules/Administration/Common/UserSpamStats.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Administration.Common; +#nullable disable +namespace NadekoBot.Modules.Administration.Common; public sealed class UserSpamStats : IDisposable { @@ -40,4 +41,4 @@ public sealed class UserSpamStats : IDisposable while (timers.TryDequeue(out var old)) old.Change(Timeout.Infinite, Timeout.Infinite); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/DangerousCommands.cs b/src/NadekoBot/Modules/Administration/DangerousCommands.cs index b1dd4eae6..68d2fec0b 100644 --- a/src/NadekoBot/Modules/Administration/DangerousCommands.cs +++ b/src/NadekoBot/Modules/Administration/DangerousCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; #if !GLOBAL_NADEKO namespace NadekoBot.Modules.Administration @@ -122,4 +123,4 @@ namespace NadekoBot.Modules.Administration } } } -#endif \ No newline at end of file +#endif diff --git a/src/NadekoBot/Modules/Administration/DiscordPermOverrideCommands.cs b/src/NadekoBot/Modules/Administration/DiscordPermOverrideCommands.cs index d1e5340d9..9c72987de 100644 --- a/src/NadekoBot/Modules/Administration/DiscordPermOverrideCommands.cs +++ b/src/NadekoBot/Modules/Administration/DiscordPermOverrideCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders; +#nullable disable +using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -77,4 +78,4 @@ public partial class Administration }, overrides.Count, 9, true); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/GameChannelCommands.cs b/src/NadekoBot/Modules/Administration/GameChannelCommands.cs index 2d016975c..cf041ac88 100644 --- a/src/NadekoBot/Modules/Administration/GameChannelCommands.cs +++ b/src/NadekoBot/Modules/Administration/GameChannelCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -33,4 +34,4 @@ public partial class Administration } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Common/GreetGrouper.cs b/src/NadekoBot/Modules/Administration/GreetBye/GreetGrouper.cs similarity index 73% rename from src/NadekoBot/Services/Common/GreetGrouper.cs rename to src/NadekoBot/Modules/Administration/GreetBye/GreetGrouper.cs index d0728fccd..90294c09c 100644 --- a/src/NadekoBot/Services/Common/GreetGrouper.cs +++ b/src/NadekoBot/Modules/Administration/GreetBye/GreetGrouper.cs @@ -1,12 +1,12 @@ -namespace NadekoBot.Services; +namespace NadekoBot.Services; public class GreetGrouper { - private readonly Dictionary> group; - private readonly object locker = new(); + private readonly Dictionary> _group; + private readonly object _locker = new(); public GreetGrouper() - => group = new(); + => _group = new(); /// @@ -17,15 +17,15 @@ public class GreetGrouper /// public bool CreateOrAdd(ulong guildId, T toAddIfExists) { - lock (locker) + lock (_locker) { - if (group.TryGetValue(guildId, out var list)) + if (_group.TryGetValue(guildId, out var list)) { list.Add(toAddIfExists); return false; } - group[guildId] = new(); + _group[guildId] = new(); return true; } } @@ -37,24 +37,25 @@ public class GreetGrouper /// Maximum number of items to retrieve /// Items retrieved /// Whether the group has no more items left and is deleted - public bool ClearGroup(ulong guildId, int count, out IEnumerable items) + public bool ClearGroup(ulong guildId, int count, out IReadOnlyCollection items) { - lock (locker) + lock (_locker) { - if (group.TryGetValue(guildId, out var set)) + if (_group.TryGetValue(guildId, out var set)) { // if we want more than there are, return everything if (count >= set.Count) { items = set; - group.Remove(guildId); + _group.Remove(guildId); return true; } // if there are more in the group than what's needed // take the requested number, remove them from the set // and return them - var toReturn = set.TakeWhile(item => count-- != 0).ToList(); + var toReturn = set.TakeWhile(_ => count-- != 0) + .ToList(); foreach (var item in toReturn) set.Remove(item); @@ -64,8 +65,8 @@ public class GreetGrouper return false; } - items = Enumerable.Empty(); + items = Array.Empty(); return true; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/GreetBye/GreetSettings.cs b/src/NadekoBot/Modules/Administration/GreetBye/GreetSettings.cs new file mode 100644 index 000000000..70ead129f --- /dev/null +++ b/src/NadekoBot/Modules/Administration/GreetBye/GreetSettings.cs @@ -0,0 +1,46 @@ + +using NadekoBot.Services.Database.Models; + +namespace NadekoBot.Services; + +public class GreetSettings +{ + public int AutoDeleteGreetMessagesTimer { get; set; } + public int AutoDeleteByeMessagesTimer { get; set; } + + public ulong GreetMessageChannelId { get; set; } + public ulong ByeMessageChannelId { get; set; } + + public bool SendDmGreetMessage { get; set; } + public string? DmGreetMessageText { get; set; } + + public bool SendChannelGreetMessage { get; set; } + public string? ChannelGreetMessageText { get; set; } + + public bool SendChannelByeMessage { get; set; } + public string? ChannelByeMessageText { get; set; } + + public bool SendBoostMessage { get; set; } + public string? BoostMessage { get; set; } + public int BoostMessageDeleteAfter { get; set; } + public ulong BoostMessageChannelId { get; set; } + + public static GreetSettings Create(GuildConfig g) + => new() + { + AutoDeleteByeMessagesTimer = g.AutoDeleteByeMessagesTimer, + AutoDeleteGreetMessagesTimer = g.AutoDeleteGreetMessagesTimer, + GreetMessageChannelId = g.GreetMessageChannelId, + ByeMessageChannelId = g.ByeMessageChannelId, + SendDmGreetMessage = g.SendDmGreetMessage, + DmGreetMessageText = g.DmGreetMessageText, + SendChannelGreetMessage = g.SendChannelGreetMessage, + ChannelGreetMessageText = g.ChannelGreetMessageText, + SendChannelByeMessage = g.SendChannelByeMessage, + ChannelByeMessageText = g.ChannelByeMessageText, + SendBoostMessage = g.SendBoostMessage, + BoostMessage = g.BoostMessage, + BoostMessageDeleteAfter = g.BoostMessageDeleteAfter, + BoostMessageChannelId = g.BoostMessageChannelId + }; +} diff --git a/src/NadekoBot/Services/GreetSettingsService.cs b/src/NadekoBot/Modules/Administration/GreetBye/GreetSettingsService.cs similarity index 55% rename from src/NadekoBot/Services/GreetSettingsService.cs rename to src/NadekoBot/Modules/Administration/GreetBye/GreetSettingsService.cs index 796bbc24e..ef7d2e6e8 100644 --- a/src/NadekoBot/Services/GreetSettingsService.cs +++ b/src/NadekoBot/Modules/Administration/GreetBye/GreetSettingsService.cs @@ -1,4 +1,4 @@ -using NadekoBot.Services.Database.Models; +using NadekoBot.Services.Database.Models; using NadekoBot.Db; namespace NadekoBot.Services; @@ -7,34 +7,34 @@ public class GreetSettingsService : INService { private readonly DbService _db; - public ConcurrentDictionary GuildConfigsCache { get; } + private readonly ConcurrentDictionary _guildConfigsCache; private readonly DiscordSocketClient _client; - - private readonly GreetGrouper greets = new(); - private readonly GreetGrouper byes = new(); - private readonly BotConfigService _bss; - private readonly IEmbedBuilderService _eb; - public bool GroupGreets => _bss.Data.GroupGreets; - public GreetSettingsService(DiscordSocketClient client, + private readonly GreetGrouper _greets = new(); + private readonly GreetGrouper _byes = new(); + private readonly BotConfigService _bss; + + public bool GroupGreets + => _bss.Data.GroupGreets; + + public GreetSettingsService( + DiscordSocketClient client, Bot bot, DbService db, - BotConfigService bss, - IEmbedBuilderService eb) + BotConfigService bss) { _db = db; _client = client; _bss = bss; - _eb = eb; - GuildConfigsCache = new(bot.AllGuildConfigs.ToDictionary(g => g.GuildId, GreetSettings.Create)); + _guildConfigsCache = new(bot.AllGuildConfigs.ToDictionary(g => g.GuildId, GreetSettings.Create)); _client.UserJoined += UserJoined; _client.UserLeft += UserLeft; bot.JoinedGuild += Bot_JoinedGuild; _client.LeftGuild += _client_LeftGuild; - + _client.GuildMemberUpdated += ClientOnGuildMemberUpdated; } @@ -42,11 +42,8 @@ public class GreetSettingsService : INService { // if user is a new booster // or boosted again the same server - if ((optOldUser.Value is { PremiumSince: null } - && newUser is { PremiumSince: not null }) - || (optOldUser.Value?.PremiumSince is { } oldDate - && newUser?.PremiumSince is { } newDate - && newDate > oldDate)) + if ((optOldUser.Value is { PremiumSince: null } && newUser is { PremiumSince: not null }) || + (optOldUser.Value?.PremiumSince is { } oldDate && newUser.PremiumSince is { } newDate && newDate > oldDate)) { var conf = GetOrAddSettingsForGuild(newUser.Guild.Id); if (!conf.SendBoostMessage) return Task.CompletedTask; @@ -57,122 +54,132 @@ public class GreetSettingsService : INService return Task.CompletedTask; } - private Func TriggerBoostMessage(GreetSettings conf, SocketGuildUser user) => async () => - { - var channel = user.Guild.GetTextChannel(conf.BoostMessageChannelId); - if (channel is null) - return; - - if (string.IsNullOrWhiteSpace(conf.BoostMessage)) - return; - - var toSend = SmartText.CreateFrom(conf.BoostMessage); - var rep = new ReplacementBuilder() - .WithDefault(user, channel, user.Guild, _client) - .Build(); - - try + private Func TriggerBoostMessage(GreetSettings conf, SocketGuildUser user) + => async () => { - var toDelete = await channel.SendAsync(rep.Replace(toSend)); - if (conf.BoostMessageDeleteAfter > 0) + var channel = user.Guild.GetTextChannel(conf.BoostMessageChannelId); + if (channel is null) + return; + + if (string.IsNullOrWhiteSpace(conf.BoostMessage)) + return; + + var toSend = SmartText.CreateFrom(conf.BoostMessage); + var rep = new ReplacementBuilder().WithDefault(user, + channel, + user.Guild, + _client + ) + .Build(); + + try { - toDelete.DeleteAfter(conf.BoostMessageDeleteAfter); + var toDelete = await channel.SendAsync(rep.Replace(toSend)); + if (conf.BoostMessageDeleteAfter > 0) + { + toDelete.DeleteAfter(conf.BoostMessageDeleteAfter); + } } - } - catch (Exception ex) - { - Log.Error(ex, "Error sending boost message."); - } - }; + catch (Exception ex) + { + Log.Error(ex, "Error sending boost message"); + } + }; private Task _client_LeftGuild(SocketGuild arg) { - GuildConfigsCache.TryRemove(arg.Id, out _); + _guildConfigsCache.TryRemove(arg.Id, out _); return Task.CompletedTask; } private Task Bot_JoinedGuild(GuildConfig gc) { - GuildConfigsCache.AddOrUpdate(gc.GuildId, + _guildConfigsCache.AddOrUpdate(gc.GuildId, GreetSettings.Create(gc), - delegate { return GreetSettings.Create(gc); }); + delegate { return GreetSettings.Create(gc); } + ); return Task.CompletedTask; } private Task UserLeft(SocketGuild guild, SocketUser user) { var _ = Task.Run(async () => - { - try { - var conf = GetOrAddSettingsForGuild(guild.Id); - - if (!conf.SendChannelByeMessage) return; - var channel = guild.TextChannels.FirstOrDefault(c => c.Id == conf.ByeMessageChannelId); - - if (channel is null) //maybe warn the server owner that the channel is missing - return; - - if (GroupGreets) + try { - // if group is newly created, greet that user right away, - // but any user which joins in the next 5 seconds will - // be greeted in a group greet - if (byes.CreateOrAdd(guild.Id, user)) + var conf = GetOrAddSettingsForGuild(guild.Id); + + if (!conf.SendChannelByeMessage) return; + var channel = guild.TextChannels.FirstOrDefault(c => c.Id == conf.ByeMessageChannelId); + + if (channel is null) //maybe warn the server owner that the channel is missing + return; + + if (GroupGreets) { - // greet single user - await ByeUsers(conf, channel, new[] {user}); - var groupClear = false; - while(!groupClear) + // if group is newly created, greet that user right away, + // but any user which joins in the next 5 seconds will + // be greeted in a group greet + if (_byes.CreateOrAdd(guild.Id, user)) { - await Task.Delay(5000).ConfigureAwait(false); - groupClear = byes.ClearGroup(guild.Id, 5, out var toBye); - await ByeUsers(conf, channel, toBye); + // greet single user + await ByeUsers(conf, channel, new[] { user }); + var groupClear = false; + while (!groupClear) + { + await Task.Delay(5000) + .ConfigureAwait(false); + groupClear = _byes.ClearGroup(guild.Id, 5, out var toBye); + await ByeUsers(conf, channel, toBye); + } } } + else + { + await ByeUsers(conf, channel, new[] { user }); + } } - else + catch { - await ByeUsers(conf, channel, new[] {user}); + // ignored } } - catch - { - // ignored - } - }); + ); return Task.CompletedTask; } - public string GetDmGreetMsg(ulong id) + public string? GetDmGreetMsg(ulong id) { using var uow = _db.GetDbContext(); - return uow.GuildConfigsForId(id, set => set)?.DmGreetMessageText; + return uow.GuildConfigsForId(id, set => set) + ?.DmGreetMessageText; } - public string GetGreetMsg(ulong gid) + public string? GetGreetMsg(ulong gid) { using var uow = _db.GetDbContext(); - return uow.GuildConfigsForId(gid, set => set).ChannelGreetMessageText; + return uow.GuildConfigsForId(gid, set => set) + .ChannelGreetMessageText; } - - public string GetBoostMessage(ulong gid) + + public string? GetBoostMessage(ulong gid) { using var uow = _db.GetDbContext(); - return uow.GuildConfigsForId(gid, set => set).BoostMessage; + return uow.GuildConfigsForId(gid, set => set) + .BoostMessage; } private Task ByeUsers(GreetSettings conf, ITextChannel channel, IUser user) - => ByeUsers(conf, channel, new[] {user}); - private async Task ByeUsers(GreetSettings conf, ITextChannel channel, IEnumerable users) + => ByeUsers(conf, channel, new[] { user }); + + private async Task ByeUsers(GreetSettings conf, ITextChannel channel, IReadOnlyCollection users) { if (!users.Any()) return; - - var rep = new ReplacementBuilder() - .WithChannel(channel) + + var rep = new ReplacementBuilder().WithChannel(channel) .WithClient(_client) - .WithServer(_client, (SocketGuild) channel.Guild) + .WithServer(_client, (SocketGuild)channel.Guild) .WithManyUsers(users) .Build(); @@ -191,19 +198,18 @@ public class GreetSettingsService : INService Log.Warning(ex, "Error embeding bye message"); } } - + private Task GreetUsers(GreetSettings conf, ITextChannel channel, IGuildUser user) - => GreetUsers(conf, channel, new[] {user}); - - private async Task GreetUsers(GreetSettings conf, ITextChannel channel, IEnumerable users) + => GreetUsers(conf, channel, new[] { user }); + + private async Task GreetUsers(GreetSettings conf, ITextChannel channel, IReadOnlyCollection users) { - if (!users.Any()) + if (users.Count == 0) return; - - var rep = new ReplacementBuilder() - .WithChannel(channel) + + var rep = new ReplacementBuilder().WithChannel(channel) .WithClient(_client) - .WithServer(_client, (SocketGuild) channel.Guild) + .WithServer(_client, (SocketGuild)channel.Guild) .WithManyUsers(users) .Build(); @@ -211,7 +217,8 @@ public class GreetSettingsService : INService text = rep.Replace(text); try { - var toDelete = await channel.SendAsync(text).ConfigureAwait(false); + var toDelete = await channel.SendAsync(text) + .ConfigureAwait(false); if (conf.AutoDeleteGreetMessagesTimer > 0) { toDelete.DeleteAfter(conf.AutoDeleteGreetMessagesTimer); @@ -225,15 +232,19 @@ public class GreetSettingsService : INService private async Task GreetDmUser(GreetSettings conf, IDMChannel channel, IGuildUser user) { - var rep = new ReplacementBuilder() - .WithDefault(user, channel, (SocketGuild)user.Guild, _client) + var rep = new ReplacementBuilder().WithDefault(user, + channel, + (SocketGuild)user.Guild, + _client + ) .Build(); var text = SmartText.CreateFrom(conf.DmGreetMessageText); rep.Replace(text); try { - await channel.SendAsync(text).ConfigureAwait(false); + await channel.SendAsync(text) + .ConfigureAwait(false); } catch { @@ -246,70 +257,71 @@ public class GreetSettingsService : INService private Task UserJoined(IGuildUser user) { var _ = Task.Run(async () => - { - try { - var conf = GetOrAddSettingsForGuild(user.GuildId); - - if (conf.SendChannelGreetMessage) + try { - var channel = await user.Guild.GetTextChannelAsync(conf.GreetMessageChannelId); - if (channel != null) + var conf = GetOrAddSettingsForGuild(user.GuildId); + + if (conf.SendChannelGreetMessage) { - if (GroupGreets) + var channel = await user.Guild.GetTextChannelAsync(conf.GreetMessageChannelId); + if (channel != null) { - // if group is newly created, greet that user right away, - // but any user which joins in the next 5 seconds will - // be greeted in a group greet - if (greets.CreateOrAdd(user.GuildId, user)) + if (GroupGreets) { - // greet single user - await GreetUsers(conf, channel, new[] {user}); - var groupClear = false; - while(!groupClear) + // if group is newly created, greet that user right away, + // but any user which joins in the next 5 seconds will + // be greeted in a group greet + if (_greets.CreateOrAdd(user.GuildId, user)) { - await Task.Delay(5000).ConfigureAwait(false); - groupClear = greets.ClearGroup(user.GuildId, 5, out var toGreet); - await GreetUsers(conf, channel, toGreet); + // greet single user + await GreetUsers(conf, channel, new[] { user }); + var groupClear = false; + while (!groupClear) + { + await Task.Delay(5000) + .ConfigureAwait(false); + groupClear = _greets.ClearGroup(user.GuildId, 5, out var toGreet); + await GreetUsers(conf, channel, toGreet); + } } } - } - else - { - await GreetUsers(conf, channel, new[] {user}); + else + { + await GreetUsers(conf, channel, new[] { user }); + } } } - } - - if (conf.SendDmGreetMessage) - { - var channel = await user.CreateDMChannelAsync(); - - if (channel is not null) + if (conf.SendDmGreetMessage) { - await GreetDmUser(conf, channel, user); + var channel = await user.CreateDMChannelAsync(); + + if (channel is not null) + { + await GreetDmUser(conf, channel, user); + } } } + catch + { + // ignored + } } - catch - { - // ignored - } - }); + ); return Task.CompletedTask; } - public string GetByeMessage(ulong gid) + public string? GetByeMessage(ulong gid) { using var uow = _db.GetDbContext(); - return uow.GuildConfigsForId(gid, set => set).ChannelByeMessageText; + return uow.GuildConfigsForId(gid, set => set) + .ChannelByeMessageText; } public GreetSettings GetOrAddSettingsForGuild(ulong guildId) { - if (GuildConfigsCache.TryGetValue(guildId, out var settings) && - settings != null) + if (_guildConfigsCache.TryGetValue(guildId, out var settings)) return settings; using (var uow = _db.GetDbContext()) @@ -318,7 +330,7 @@ public class GreetSettingsService : INService settings = GreetSettings.Create(gc); } - GuildConfigsCache.TryAdd(guildId, settings); + _guildConfigsCache.TryAdd(guildId, settings); return settings; } @@ -351,7 +363,7 @@ public class GreetSettingsService : INService await uow.SaveChangesAsync(); var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); return true; } @@ -365,7 +377,7 @@ public class GreetSettingsService : INService conf.GreetMessageChannelId = channelId; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); await uow.SaveChangesAsync(); return enabled; @@ -373,19 +385,18 @@ public class GreetSettingsService : INService public bool SetGreetMessage(ulong guildId, ref string message) { - message = message?.SanitizeMentions(); + message = message.SanitizeMentions(); if (string.IsNullOrWhiteSpace(message)) throw new ArgumentNullException(nameof(message)); - bool greetMsgEnabled; using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); conf.ChannelGreetMessageText = message; - greetMsgEnabled = conf.SendChannelGreetMessage; + var greetMsgEnabled = conf.SendChannelGreetMessage; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); uow.SaveChanges(); return greetMsgEnabled; @@ -393,41 +404,42 @@ public class GreetSettingsService : INService public async Task SetGreetDm(ulong guildId, bool? value = null) { - bool enabled; await using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); - enabled = conf.SendDmGreetMessage = value ?? !conf.SendDmGreetMessage; + var enabled = conf.SendDmGreetMessage = value ?? !conf.SendDmGreetMessage; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); await uow.SaveChangesAsync(); return enabled; } #region Get Enabled Status + public bool GetGreetDmEnabled(ulong guildId) { using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); return conf.SendDmGreetMessage; } - + public bool GetGreetEnabled(ulong guildId) { using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); return conf.SendChannelGreetMessage; } - + public bool GetByeEnabled(ulong guildId) { using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); return conf.SendChannelByeMessage; } + #endregion - + #region Test Messages public Task ByeTest(ITextChannel channel, IGuildUser user) @@ -435,73 +447,69 @@ public class GreetSettingsService : INService var conf = GetOrAddSettingsForGuild(user.GuildId); return ByeUsers(conf, channel, user); } - + public Task GreetTest(ITextChannel channel, IGuildUser user) { var conf = GetOrAddSettingsForGuild(user.GuildId); return GreetUsers(conf, channel, user); } - + public Task GreetDmTest(IDMChannel channel, IGuildUser user) { var conf = GetOrAddSettingsForGuild(user.GuildId); return GreetDmUser(conf, channel, user); } + #endregion - public bool SetGreetDmMessage(ulong guildId, ref string message) + public bool SetGreetDmMessage(ulong guildId, ref string? message) { message = message?.SanitizeMentions(); if (string.IsNullOrWhiteSpace(message)) throw new ArgumentNullException(nameof(message)); - bool greetMsgEnabled; using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); conf.DmGreetMessageText = message; - greetMsgEnabled = conf.SendDmGreetMessage; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); uow.SaveChanges(); - return greetMsgEnabled; + return conf.SendDmGreetMessage; } public async Task SetBye(ulong guildId, ulong channelId, bool? value = null) { - bool enabled; await using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); - enabled = conf.SendChannelByeMessage = value ?? !conf.SendChannelByeMessage; + var enabled = conf.SendChannelByeMessage = value ?? !conf.SendChannelByeMessage; conf.ByeMessageChannelId = channelId; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); await uow.SaveChangesAsync(); return enabled; } - public bool SetByeMessage(ulong guildId, ref string message) + public bool SetByeMessage(ulong guildId, ref string? message) { message = message?.SanitizeMentions(); if (string.IsNullOrWhiteSpace(message)) throw new ArgumentNullException(nameof(message)); - bool byeMsgEnabled; using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); conf.ChannelByeMessageText = message; - byeMsgEnabled = conf.SendChannelByeMessage; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); uow.SaveChanges(); - return byeMsgEnabled; + return conf.SendChannelByeMessage; } public async Task SetByeDel(ulong guildId, int timer) @@ -514,7 +522,7 @@ public class GreetSettingsService : INService conf.AutoDeleteByeMessagesTimer = timer; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); await uow.SaveChangesAsync(); } @@ -529,21 +537,21 @@ public class GreetSettingsService : INService conf.AutoDeleteGreetMessagesTimer = timer; var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(id, toAdd, (key, old) => toAdd); + _guildConfigsCache.AddOrUpdate(id, toAdd, (_, _) => toAdd); await uow.SaveChangesAsync(); } public bool SetBoostMessage(ulong guildId, ref string message) { - message = message?.SanitizeMentions(); - + message = message.SanitizeMentions(); + using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); conf.BoostMessage = message; - + var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd,(_, _) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); uow.SaveChanges(); return conf.SendBoostMessage; @@ -557,10 +565,10 @@ public class GreetSettingsService : INService await using var uow = _db.GetDbContext(); var conf = uow.GuildConfigsForId(guildId, set => set); conf.BoostMessageDeleteAfter = timer; - + var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd,(_, _) => toAdd); - + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); + await uow.SaveChangesAsync(); } @@ -573,49 +581,7 @@ public class GreetSettingsService : INService await uow.SaveChangesAsync(); var toAdd = GreetSettings.Create(conf); - GuildConfigsCache.AddOrUpdate(guildId, toAdd,(_, _) => toAdd); + _guildConfigsCache.AddOrUpdate(guildId, toAdd, (_, _) => toAdd); return conf.SendBoostMessage; } -} - -public class GreetSettings -{ - public int AutoDeleteGreetMessagesTimer { get; set; } - public int AutoDeleteByeMessagesTimer { get; set; } - - public ulong GreetMessageChannelId { get; set; } - public ulong ByeMessageChannelId { get; set; } - - public bool SendDmGreetMessage { get; set; } - public string DmGreetMessageText { get; set; } - - public bool SendChannelGreetMessage { get; set; } - public string ChannelGreetMessageText { get; set; } - - public bool SendChannelByeMessage { get; set; } - public string ChannelByeMessageText { get; set; } - - public bool SendBoostMessage { get; set; } - public string BoostMessage { get; set; } - public int BoostMessageDeleteAfter { get; set; } - public ulong BoostMessageChannelId { get; set; } - - public static GreetSettings Create(GuildConfig g) => new() - { - AutoDeleteByeMessagesTimer = g.AutoDeleteByeMessagesTimer, - AutoDeleteGreetMessagesTimer = g.AutoDeleteGreetMessagesTimer, - GreetMessageChannelId = g.GreetMessageChannelId, - ByeMessageChannelId = g.ByeMessageChannelId, - SendDmGreetMessage = g.SendDmGreetMessage, - DmGreetMessageText = g.DmGreetMessageText, - SendChannelGreetMessage = g.SendChannelGreetMessage, - ChannelGreetMessageText = g.ChannelGreetMessageText, - SendChannelByeMessage = g.SendChannelByeMessage, - ChannelByeMessageText = g.ChannelByeMessageText, - - SendBoostMessage = g.SendBoostMessage, - BoostMessage = g.BoostMessage, - BoostMessageDeleteAfter = g.BoostMessageDeleteAfter, - BoostMessageChannelId = g.BoostMessageChannelId - }; } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Administration/ServerGreetCommands.cs b/src/NadekoBot/Modules/Administration/GreetBye/ServerGreetCommands.cs similarity index 64% rename from src/NadekoBot/Modules/Administration/ServerGreetCommands.cs rename to src/NadekoBot/Modules/Administration/GreetBye/ServerGreetCommands.cs index 0877295d3..79f08d76c 100644 --- a/src/NadekoBot/Modules/Administration/ServerGreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/GreetBye/ServerGreetCommands.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Modules.Administration; +namespace NadekoBot.Modules.Administration; public partial class Administration { @@ -13,11 +13,11 @@ public partial class Administration var enabled = await _service.ToggleBoost(ctx.Guild.Id, ctx.Channel.Id); if (enabled) - await ReplyConfirmLocalizedAsync(strs.boost_on).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.boost_on); else - await ReplyPendingLocalizedAsync(strs.boost_off).ConfigureAwait(false); + await ReplyPendingLocalizedAsync(strs.boost_off); } - + [NadekoCommand, Aliases] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] @@ -31,32 +31,24 @@ public partial class Administration if (timer > 0) await ReplyConfirmLocalizedAsync(strs.boostdel_on(timer)); else - await ReplyPendingLocalizedAsync(strs.boostdel_off).ConfigureAwait(false); + await ReplyPendingLocalizedAsync(strs.boostdel_off); } [NadekoCommand, Aliases] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public Task BoostMsg() - { - var boostMessage = _service.GetBoostMessage(ctx.Guild.Id); - return ReplyConfirmLocalizedAsync(strs.boostmsg_cur(boostMessage?.SanitizeMentions())); - } - - [NadekoCommand, Aliases] - [RequireContext(ContextType.Guild)] - [UserPerm(GuildPerm.ManageGuild)] - public async Task BoostMsg([Leftover] string text) + public async Task BoostMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { - await BoostMsg().ConfigureAwait(false); + var boostMessage = _service.GetBoostMessage(ctx.Guild.Id); + await ReplyConfirmLocalizedAsync(strs.boostmsg_cur(boostMessage?.SanitizeMentions())); return; } var sendBoostEnabled = _service.SetBoostMessage(ctx.Guild.Id, ref text); - await ReplyConfirmLocalizedAsync(strs.boostmsg_new).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.boostmsg_new); if (!sendBoostEnabled) await ReplyPendingLocalizedAsync(strs.boostmsg_enable($"`{Prefix}boost`")); } @@ -69,12 +61,12 @@ public partial class Administration if (timer is < 0 or > 600) return; - await _service.SetGreetDel(ctx.Guild.Id, timer).ConfigureAwait(false); + await _service.SetGreetDel(ctx.Guild.Id, timer); if (timer > 0) await ReplyConfirmLocalizedAsync(strs.greetdel_on(timer)); else - await ReplyPendingLocalizedAsync(strs.greetdel_off).ConfigureAwait(false); + await ReplyPendingLocalizedAsync(strs.greetdel_off); } [NadekoCommand, Aliases] @@ -82,37 +74,30 @@ public partial class Administration [UserPerm(GuildPerm.ManageGuild)] public async Task Greet() { - var enabled = await _service.SetGreet(ctx.Guild.Id, ctx.Channel.Id).ConfigureAwait(false); + var enabled = await _service.SetGreet(ctx.Guild.Id, ctx.Channel.Id); if (enabled) - await ReplyConfirmLocalizedAsync(strs.greet_on).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.greet_on); else - await ReplyPendingLocalizedAsync(strs.greet_off).ConfigureAwait(false); + await ReplyPendingLocalizedAsync(strs.greet_off); } [NadekoCommand, Aliases] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public Task GreetMsg() - { - var greetMsg = _service.GetGreetMsg(ctx.Guild.Id); - return ReplyConfirmLocalizedAsync(strs.greetmsg_cur(greetMsg?.SanitizeMentions())); - } - - [NadekoCommand, Aliases] - [RequireContext(ContextType.Guild)] - [UserPerm(GuildPerm.ManageGuild)] - public async Task GreetMsg([Leftover] string text) + public async Task GreetMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { - await GreetMsg().ConfigureAwait(false); - return; + var greetMsg = _service.GetGreetMsg(ctx.Guild.Id); + await ReplyConfirmLocalizedAsync(strs.greetmsg_cur(greetMsg?.SanitizeMentions())); + return; } var sendGreetEnabled = _service.SetGreetMessage(ctx.Guild.Id, ref text); - await ReplyConfirmLocalizedAsync(strs.greetmsg_new).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.greetmsg_new); + if (!sendGreetEnabled) await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`")); } @@ -122,37 +107,29 @@ public partial class Administration [UserPerm(GuildPerm.ManageGuild)] public async Task GreetDm() { - var enabled = await _service.SetGreetDm(ctx.Guild.Id).ConfigureAwait(false); + var enabled = await _service.SetGreetDm(ctx.Guild.Id); if (enabled) - await ReplyConfirmLocalizedAsync(strs.greetdm_on).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.greetdm_on); else - await ReplyConfirmLocalizedAsync(strs.greetdm_off).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.greetdm_off); } [NadekoCommand, Aliases] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public Task GreetDmMsg() - { - var dmGreetMsg = _service.GetDmGreetMsg(ctx.Guild.Id); - return ReplyConfirmLocalizedAsync(strs.greetdmmsg_cur(dmGreetMsg?.SanitizeMentions())); - } - - [NadekoCommand, Aliases] - [RequireContext(ContextType.Guild)] - [UserPerm(GuildPerm.ManageGuild)] - public async Task GreetDmMsg([Leftover] string text = null) + public async Task GreetDmMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { - await GreetDmMsg().ConfigureAwait(false); + var dmGreetMsg = _service.GetDmGreetMsg(ctx.Guild.Id); + await ReplyConfirmLocalizedAsync(strs.greetdmmsg_cur(dmGreetMsg?.SanitizeMentions())); return; } var sendGreetEnabled = _service.SetGreetDmMessage(ctx.Guild.Id, ref text); - await ReplyConfirmLocalizedAsync(strs.greetdmmsg_new).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.greetdmmsg_new); if (!sendGreetEnabled) await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`")); } @@ -162,37 +139,29 @@ public partial class Administration [UserPerm(GuildPerm.ManageGuild)] public async Task Bye() { - var enabled = await _service.SetBye(ctx.Guild.Id, ctx.Channel.Id).ConfigureAwait(false); + var enabled = await _service.SetBye(ctx.Guild.Id, ctx.Channel.Id); if (enabled) - await ReplyConfirmLocalizedAsync(strs.bye_on).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.bye_on); else - await ReplyConfirmLocalizedAsync(strs.bye_off).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.bye_off); } [NadekoCommand, Aliases] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public Task ByeMsg() - { - var byeMsg = _service.GetByeMessage(ctx.Guild.Id); - return ReplyConfirmLocalizedAsync(strs.byemsg_cur(byeMsg?.SanitizeMentions())); - } - - [NadekoCommand, Aliases] - [RequireContext(ContextType.Guild)] - [UserPerm(GuildPerm.ManageGuild)] - public async Task ByeMsg([Leftover] string text) + public async Task ByeMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { - await ByeMsg().ConfigureAwait(false); + var byeMsg = _service.GetByeMessage(ctx.Guild.Id); + await ReplyConfirmLocalizedAsync(strs.byemsg_cur(byeMsg?.SanitizeMentions())); return; } var sendByeEnabled = _service.SetByeMessage(ctx.Guild.Id, ref text); - await ReplyConfirmLocalizedAsync(strs.byemsg_new).ConfigureAwait(false); + await ReplyConfirmLocalizedAsync(strs.byemsg_new); if (!sendByeEnabled) await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`")); } @@ -202,12 +171,12 @@ public partial class Administration [UserPerm(GuildPerm.ManageGuild)] public async Task ByeDel(int timer = 30) { - await _service.SetByeDel(ctx.Guild.Id, timer).ConfigureAwait(false); + await _service.SetByeDel(ctx.Guild.Id, timer); if (timer > 0) await ReplyConfirmLocalizedAsync(strs.byedel_on(timer)); else - await ReplyPendingLocalizedAsync(strs.byedel_off).ConfigureAwait(false); + await ReplyPendingLocalizedAsync(strs.byedel_off); } @@ -215,10 +184,10 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] [Ratelimit(5)] - public async Task ByeTest([Leftover] IGuildUser user = null) + public async Task ByeTest([Leftover] IGuildUser? user = null) { - user = user ?? (IGuildUser) ctx.User; - + user ??= (IGuildUser)ctx.User; + await _service.ByeTest((ITextChannel)ctx.Channel, user); var enabled = _service.GetByeEnabled(ctx.Guild.Id); if (!enabled) @@ -226,15 +195,15 @@ public partial class Administration await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`")); } } - + [NadekoCommand, Aliases] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] [Ratelimit(5)] - public async Task GreetTest([Leftover] IGuildUser user = null) + public async Task GreetTest([Leftover] IGuildUser? user = null) { - user = user ?? (IGuildUser) ctx.User; - + user ??= (IGuildUser)ctx.User; + await _service.GreetTest((ITextChannel)ctx.Channel, user); var enabled = _service.GetGreetEnabled(ctx.Guild.Id); if (!enabled) @@ -247,10 +216,10 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] [Ratelimit(5)] - public async Task GreetDmTest([Leftover] IGuildUser user = null) + public async Task GreetDmTest([Leftover] IGuildUser? user = null) { - user = user ?? (IGuildUser) ctx.User; - + user ??= (IGuildUser)ctx.User; + var channel = await user.CreateDMChannelAsync(); var success = await _service.GreetDmTest(channel, user); if (success) @@ -262,4 +231,4 @@ public partial class Administration await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`")); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/LocalizationCommands.cs b/src/NadekoBot/Modules/Administration/LocalizationCommands.cs index 940196f7a..4742331b7 100644 --- a/src/NadekoBot/Modules/Administration/LocalizationCommands.cs +++ b/src/NadekoBot/Modules/Administration/LocalizationCommands.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; namespace NadekoBot.Modules.Administration; @@ -247,4 +248,4 @@ public partial class Administration { "YE", "ar-YE" }, { "ZA", "af-ZA" }, { "ZW", "en-ZW" } - */ \ No newline at end of file + */ diff --git a/src/NadekoBot/Modules/Administration/LogCommands.cs b/src/NadekoBot/Modules/Administration/LogCommands.cs index b0d4c8e32..962de1cd3 100644 --- a/src/NadekoBot/Modules/Administration/LogCommands.cs +++ b/src/NadekoBot/Modules/Administration/LogCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders.Models; +#nullable disable +using NadekoBot.Common.TypeReaders.Models; using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Administration.Services; @@ -150,4 +151,4 @@ public partial class Administration await ReplyConfirmLocalizedAsync(strs.log_stop(Format.Bold(type.ToString()))).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/MuteCommands.cs b/src/NadekoBot/Modules/Administration/MuteCommands.cs index 4fc966655..65ef4f04a 100644 --- a/src/NadekoBot/Modules/Administration/MuteCommands.cs +++ b/src/NadekoBot/Modules/Administration/MuteCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders.Models; +#nullable disable +using NadekoBot.Common.TypeReaders.Models; using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -224,4 +225,4 @@ public partial class Administration } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/PlayingRotateCommands.cs b/src/NadekoBot/Modules/Administration/PlayingRotateCommands.cs index d32f9d606..24c0a92a2 100644 --- a/src/NadekoBot/Modules/Administration/PlayingRotateCommands.cs +++ b/src/NadekoBot/Modules/Administration/PlayingRotateCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -59,4 +60,4 @@ public partial class Administration await ReplyConfirmLocalizedAsync(strs.reprm(msg)); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/PrefixCommands.cs b/src/NadekoBot/Modules/Administration/PrefixCommands.cs index 8ed0611c5..66cb73eb0 100644 --- a/src/NadekoBot/Modules/Administration/PrefixCommands.cs +++ b/src/NadekoBot/Modules/Administration/PrefixCommands.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Administration; +#nullable disable +namespace NadekoBot.Modules.Administration; public partial class Administration { @@ -53,4 +54,4 @@ public partial class Administration await ReplyConfirmLocalizedAsync(strs.defprefix_new(Format.Code(oldPrefix), Format.Code(newPrefix))).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/ProtectionCommands.cs b/src/NadekoBot/Modules/Administration/ProtectionCommands.cs index 91aaf8cc4..28c40d40d 100644 --- a/src/NadekoBot/Modules/Administration/ProtectionCommands.cs +++ b/src/NadekoBot/Modules/Administration/ProtectionCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Administration.Common; using NadekoBot.Modules.Administration.Services; using NadekoBot.Common.TypeReaders.Models; @@ -283,4 +284,4 @@ public partial class Administration actionString)); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/PruneCommands.cs b/src/NadekoBot/Modules/Administration/PruneCommands.cs index b6de14866..a7901962d 100644 --- a/src/NadekoBot/Modules/Administration/PruneCommands.cs +++ b/src/NadekoBot/Modules/Administration/PruneCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; using ITextChannel = Discord.ITextChannel; namespace NadekoBot.Modules.Administration; @@ -75,4 +76,4 @@ public partial class Administration await _service.PruneWhere((ITextChannel)ctx.Channel, count, m => m.Author.Id == userId && DateTime.UtcNow - m.CreatedAt < twoWeeks).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/RoleCommands.cs b/src/NadekoBot/Modules/Administration/RoleCommands.cs index d0dec0669..52cb02f7c 100644 --- a/src/NadekoBot/Modules/Administration/RoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/RoleCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Administration.Services; using SixLabors.ImageSharp.PixelFormats; using System.Net; @@ -345,4 +346,4 @@ public partial class Administration } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs b/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs index 6096201fc..35e46e355 100644 --- a/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs @@ -1,4 +1,5 @@ -using System.Text; +#nullable disable +using System.Text; using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -262,4 +263,4 @@ public partial class Administration } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/SelfCommands.cs b/src/NadekoBot/Modules/Administration/SelfCommands.cs index 605759edf..aea9c993d 100644 --- a/src/NadekoBot/Modules/Administration/SelfCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Administration.Services; @@ -419,7 +420,7 @@ public partial class Administration [OwnerOnly] public async Task SetStream(string url, [Leftover] string name = null) { - name = name ?? ""; + name ??= ""; await _service.SetStreamAsync(name, url).ConfigureAwait(false); @@ -523,4 +524,4 @@ public partial class Administration Dnd } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/AdministrationService.cs b/src/NadekoBot/Modules/Administration/Services/AdministrationService.cs index 711eab08e..57c0b1711 100644 --- a/src/NadekoBot/Modules/Administration/Services/AdministrationService.cs +++ b/src/NadekoBot/Modules/Administration/Services/AdministrationService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -152,4 +153,4 @@ public class AdministrationService : INService await umsg.EditAsync(text); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/AutoAssignRoleService.cs b/src/NadekoBot/Modules/Administration/Services/AutoAssignRoleService.cs index bfaa64853..093b399b5 100644 --- a/src/NadekoBot/Modules/Administration/Services/AutoAssignRoleService.cs +++ b/src/NadekoBot/Modules/Administration/Services/AutoAssignRoleService.cs @@ -1,4 +1,5 @@ -using System.Threading.Channels; +#nullable disable +using System.Threading.Channels; using LinqToDB; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; @@ -156,4 +157,4 @@ public static class GuildConfigExtensions public static void SetAutoAssignableRoles(this GuildConfig gc, IEnumerable roles) => gc.AutoAssignRoleIds = roles.Join(','); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/DangerousCommandsService.cs b/src/NadekoBot/Modules/Administration/Services/DangerousCommandsService.cs index 6820d8707..44b3ccf86 100644 --- a/src/NadekoBot/Modules/Administration/Services/DangerousCommandsService.cs +++ b/src/NadekoBot/Modules/Administration/Services/DangerousCommandsService.cs @@ -1,3 +1,4 @@ +#nullable disable using Microsoft.EntityFrameworkCore; using LinqToDB; using LinqToDB.EntityFrameworkCore; @@ -128,4 +129,4 @@ DELETE FROM Clubs;"; await uow.DiscordUser .DeleteAsync(u => u.UserId == userId); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/DiscordPermOverrideService.cs b/src/NadekoBot/Modules/Administration/Services/DiscordPermOverrideService.cs index 9fbdffbe6..39568c975 100644 --- a/src/NadekoBot/Modules/Administration/Services/DiscordPermOverrideService.cs +++ b/src/NadekoBot/Modules/Administration/Services/DiscordPermOverrideService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Services.Database.Models; @@ -131,4 +132,4 @@ public class DiscordPermOverrideService : INService, ILateBlocker return false; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/GameVoiceChannelService.cs b/src/NadekoBot/Modules/Administration/Services/GameVoiceChannelService.cs index f0235b703..49e57f802 100644 --- a/src/NadekoBot/Modules/Administration/Services/GameVoiceChannelService.cs +++ b/src/NadekoBot/Modules/Administration/Services/GameVoiceChannelService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Db; +#nullable disable +using NadekoBot.Db; namespace NadekoBot.Modules.Administration.Services; @@ -120,4 +121,4 @@ public class GameVoiceChannelService : INService await Task.Delay(1000).ConfigureAwait(false); await gUser.ModifyAsync(gu => gu.Channel = vch).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/GuildTimezoneService.cs b/src/NadekoBot/Modules/Administration/Services/GuildTimezoneService.cs index 347f639ef..d20021947 100644 --- a/src/NadekoBot/Modules/Administration/Services/GuildTimezoneService.cs +++ b/src/NadekoBot/Modules/Administration/Services/GuildTimezoneService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Db; namespace NadekoBot.Modules.Administration.Services; @@ -73,4 +74,4 @@ public class GuildTimezoneService : INService public TimeZoneInfo GetTimeZoneOrUtc(ulong guildId) => GetTimeZoneOrDefault(guildId) ?? TimeZoneInfo.Utc; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/ImageOnlyChannelService.cs b/src/NadekoBot/Modules/Administration/Services/ImageOnlyChannelService.cs index 40cd75ded..90609c732 100644 --- a/src/NadekoBot/Modules/Administration/Services/ImageOnlyChannelService.cs +++ b/src/NadekoBot/Modules/Administration/Services/ImageOnlyChannelService.cs @@ -1,4 +1,5 @@ -using System.Net; +#nullable disable +using System.Net; using System.Threading.Channels; using LinqToDB; using Microsoft.Extensions.Caching.Memory; @@ -172,4 +173,4 @@ public sealed class ImageOnlyChannelService : IEarlyBehavior } public int Priority { get; } = 0; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs b/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs index 08db75ad8..890a8ab12 100644 --- a/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs +++ b/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -1232,4 +1233,4 @@ public sealed class LogCommandService : ILogCommandService GuildLogSettings.AddOrUpdate(guildId, newLogSetting, (gid, old) => newLogSetting); uow.SaveChanges(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/MuteService.cs b/src/NadekoBot/Modules/Administration/Services/MuteService.cs index 7b52508e8..055c9a70a 100644 --- a/src/NadekoBot/Modules/Administration/Services/MuteService.cs +++ b/src/NadekoBot/Modules/Administration/Services/MuteService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -460,4 +461,4 @@ public class MuteService : INService } uow.SaveChanges(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/PlayingRotateService.cs b/src/NadekoBot/Modules/Administration/Services/PlayingRotateService.cs index 3227b1866..0d28b274c 100644 --- a/src/NadekoBot/Modules/Administration/Services/PlayingRotateService.cs +++ b/src/NadekoBot/Modules/Administration/Services/PlayingRotateService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; namespace NadekoBot.Modules.Administration.Services; @@ -109,4 +110,4 @@ public sealed class PlayingRotateService : INService using var uow = _db.GetDbContext(); return uow.RotatingStatus.AsNoTracking().ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/ProtectionService.cs b/src/NadekoBot/Modules/Administration/Services/ProtectionService.cs index f48cb7ef1..a387ec0fc 100644 --- a/src/NadekoBot/Modules/Administration/Services/ProtectionService.cs +++ b/src/NadekoBot/Modules/Administration/Services/ProtectionService.cs @@ -1,4 +1,5 @@ -using System.Threading.Channels; +#nullable disable +using System.Threading.Channels; using NadekoBot.Modules.Administration.Common; using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; @@ -465,4 +466,4 @@ public class ProtectionService : INService await uow.SaveChangesAsync(); return true; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/PruneService.cs b/src/NadekoBot/Modules/Administration/Services/PruneService.cs index b95840baa..23b8733e6 100644 --- a/src/NadekoBot/Modules/Administration/Services/PruneService.cs +++ b/src/NadekoBot/Modules/Administration/Services/PruneService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Administration.Services; +#nullable disable +namespace NadekoBot.Modules.Administration.Services; public class PruneService : INService { @@ -63,4 +64,4 @@ public class PruneService : INService _pruningGuilds.TryRemove(channel.GuildId); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/RoleCommandsService.cs b/src/NadekoBot/Modules/Administration/Services/RoleCommandsService.cs index cf010cccb..489d7fc40 100644 --- a/src/NadekoBot/Modules/Administration/Services/RoleCommandsService.cs +++ b/src/NadekoBot/Modules/Administration/Services/RoleCommandsService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Common.Collections; using NadekoBot.Services.Database.Models; using LinqToDB; @@ -239,4 +240,4 @@ public class RoleCommandsService : INService await Task.Delay(100, cToken).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/SelfAssignedRolesService.cs b/src/NadekoBot/Modules/Administration/Services/SelfAssignedRolesService.cs index eb5763690..56416b4a4 100644 --- a/src/NadekoBot/Modules/Administration/Services/SelfAssignedRolesService.cs +++ b/src/NadekoBot/Modules/Administration/Services/SelfAssignedRolesService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; using NadekoBot.Db; using NadekoBot.Modules.Xp; @@ -245,4 +246,4 @@ public class SelfAssignedRolesService : INService return (exclusive, roles.Where(x => x.Role != null), groupNames); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/SelfService.cs b/src/NadekoBot/Modules/Administration/Services/SelfService.cs index 8b631c52e..491b0807a 100644 --- a/src/NadekoBot/Modules/Administration/Services/SelfService.cs +++ b/src/NadekoBot/Modules/Administration/Services/SelfService.cs @@ -1,4 +1,5 @@ -using System.Collections.Immutable; +#nullable disable +using System.Collections.Immutable; using NadekoBot.Common.ModuleBehaviors; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; @@ -388,4 +389,4 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService public string Link { get; init; } public ActivityType Type { get; init; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/UserPunishService.cs b/src/NadekoBot/Modules/Administration/Services/UserPunishService.cs index f21096f87..2c065b88d 100644 --- a/src/NadekoBot/Modules/Administration/Services/UserPunishService.cs +++ b/src/NadekoBot/Modules/Administration/Services/UserPunishService.cs @@ -1,3 +1,4 @@ +#nullable disable using Microsoft.EntityFrameworkCore; using NadekoBot.Common.TypeReaders.Models; using NadekoBot.Services.Database.Models; @@ -488,4 +489,4 @@ WHERE GuildId={guildId} var output = SmartText.CreateFrom(template); return replacer.Replace(output); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/Services/VcRoleService.cs b/src/NadekoBot/Modules/Administration/Services/VcRoleService.cs index 34569a36c..d50359f92 100644 --- a/src/NadekoBot/Modules/Administration/Services/VcRoleService.cs +++ b/src/NadekoBot/Modules/Administration/Services/VcRoleService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -210,4 +211,4 @@ public class VcRoleService : INService var queue = ToAssign.GetOrAdd(gusr.Guild.Id, new ConcurrentQueue<(bool, IGuildUser, IRole)>()); queue.Enqueue((v, gusr, role)); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/TimeZoneCommands.cs b/src/NadekoBot/Modules/Administration/TimeZoneCommands.cs index 418db08bf..33673dd46 100644 --- a/src/NadekoBot/Modules/Administration/TimeZoneCommands.cs +++ b/src/NadekoBot/Modules/Administration/TimeZoneCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -77,4 +78,4 @@ public partial class Administration await SendConfirmAsync(tz.ToString()).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs index 3a89f65b3..00427d6a3 100644 --- a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs +++ b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using CommandLine; using Humanizer.Localisation; using NadekoBot.Common.TypeReaders.Models; @@ -896,4 +897,4 @@ public partial class Administration .Build()).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Administration/VcRoleCommands.cs b/src/NadekoBot/Modules/Administration/VcRoleCommands.cs index 3020a3dc4..6f308d2cc 100644 --- a/src/NadekoBot/Modules/Administration/VcRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/VcRoleCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Administration.Services; +#nullable disable +using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; @@ -81,4 +82,4 @@ public partial class Administration .ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/CustomReactions/Common/ExportedExpr.cs b/src/NadekoBot/Modules/CustomReactions/Common/ExportedExpr.cs index 213d7cb3e..c70b59997 100644 --- a/src/NadekoBot/Modules/CustomReactions/Common/ExportedExpr.cs +++ b/src/NadekoBot/Modules/CustomReactions/Common/ExportedExpr.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.CustomReactions; @@ -25,4 +26,4 @@ public class ExportedExpr ? null : cr.GetReactions(), }; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs index 048525af9..e011d7e62 100644 --- a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.CustomReactions.Services; +#nullable disable +using NadekoBot.Modules.CustomReactions.Services; namespace NadekoBot.Modules.CustomReactions; @@ -333,4 +334,4 @@ public class CustomReactions : NadekoModule await ctx.OkAsync(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/CustomReactions/Extensions/CustomReactionExtensions.cs b/src/NadekoBot/Modules/CustomReactions/Extensions/CustomReactionExtensions.cs index 9cb3fa652..cb91460a4 100644 --- a/src/NadekoBot/Modules/CustomReactions/Extensions/CustomReactionExtensions.cs +++ b/src/NadekoBot/Modules/CustomReactions/Extensions/CustomReactionExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using System.Runtime.CompilerServices; namespace NadekoBot.Modules.CustomReactions.Extensions; @@ -82,4 +83,4 @@ public enum WordPosition Start, Middle, End, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs b/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs index d30fbc8cf..2bb3c23e6 100644 --- a/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs +++ b/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Services.Database.Models; using NadekoBot.Modules.CustomReactions.Extensions; using NadekoBot.Modules.Permissions.Common; @@ -726,4 +727,4 @@ public sealed class CustomReactionsService : IEarlyBehavior, IReadyExecutor await TriggerReloadCustomReactions(); return true; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs b/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs index d1b38811d..9f1e8d877 100644 --- a/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs +++ b/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common; +#nullable disable +using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.AnimalRacing; using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; @@ -172,4 +173,4 @@ public partial class Gambling } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/BlackJackCommands.cs b/src/NadekoBot/Modules/Gambling/BlackJackCommands.cs index 9ad802308..80a3fb917 100644 --- a/src/NadekoBot/Modules/Gambling/BlackJackCommands.cs +++ b/src/NadekoBot/Modules/Gambling/BlackJackCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common; +#nullable disable +using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.Blackjack; using NadekoBot.Modules.Gambling.Services; @@ -180,4 +181,4 @@ public partial class Gambling await ctx.Message.DeleteAsync().ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRace.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRace.cs index 36c68aa7f..3a32813d6 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRace.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRace.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; +#nullable disable +using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; using NadekoBot.Modules.Games.Common; namespace NadekoBot.Modules.Gambling.Common.AnimalRacing; @@ -148,4 +149,4 @@ public sealed class AnimalRace : IDisposable _locker.Dispose(); _users.Clear(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRacingUser.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRacingUser.cs index 8c4c9c6f1..e07125f78 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRacingUser.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/AnimalRacingUser.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Games.Common; +#nullable disable +using NadekoBot.Modules.Games.Common; namespace NadekoBot.Modules.Gambling.Common.AnimalRacing; @@ -24,4 +25,4 @@ public class AnimalRacingUser public override int GetHashCode() => this.UserId.GetHashCode(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyJoinedException.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyJoinedException.cs index 6638b5d50..3888b5ebc 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyJoinedException.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyJoinedException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; public class AlreadyJoinedException : Exception { @@ -14,4 +15,4 @@ public class AlreadyJoinedException : Exception public AlreadyJoinedException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyStartedException.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyStartedException.cs index 537d51a81..ac37c164b 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyStartedException.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AlreadyStartedException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; public class AlreadyStartedException : Exception { @@ -13,4 +14,4 @@ public class AlreadyStartedException : Exception public AlreadyStartedException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AnimalRaceFullException.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AnimalRaceFullException.cs index d8dafe293..f48f0cf80 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AnimalRaceFullException.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/AnimalRaceFullException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; public class AnimalRaceFullException : Exception { @@ -13,4 +14,4 @@ public class AnimalRaceFullException : Exception public AnimalRaceFullException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/NotEnoughFundsException.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/NotEnoughFundsException.cs index d0ba2557c..10f28643b 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/NotEnoughFundsException.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/Exceptions/NotEnoughFundsException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; public class NotEnoughFundsException : Exception { @@ -13,4 +14,4 @@ public class NotEnoughFundsException : Exception public NotEnoughFundsException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/RaceOptions.cs b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/RaceOptions.cs index ec9aefb6f..3fb51dca9 100644 --- a/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/RaceOptions.cs +++ b/src/NadekoBot/Modules/Gambling/Common/AnimalRacing/RaceOptions.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; namespace NadekoBot.Modules.Gambling.Common.AnimalRacing; @@ -12,4 +13,4 @@ public class RaceOptions : INadekoCommandOptions if (this.StartTime is < 10 or > 120) this.StartTime = 20; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/BetRoll.cs b/src/NadekoBot/Modules/Gambling/Common/BetRoll.cs index ee31fd74e..db9a1b474 100644 --- a/src/NadekoBot/Modules/Gambling/Common/BetRoll.cs +++ b/src/NadekoBot/Modules/Gambling/Common/BetRoll.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common; public class Betroll { @@ -40,4 +41,4 @@ public class Betroll Threshold = pair.WhenAbove, }; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Blackjack/Blackjack.cs b/src/NadekoBot/Modules/Gambling/Common/Blackjack/Blackjack.cs index bad4ef035..f40fd2ed0 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Blackjack/Blackjack.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Blackjack/Blackjack.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.Blackjack; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Blackjack; public class Blackjack { @@ -339,4 +340,4 @@ public class Blackjack return Task.CompletedTask; return StateUpdated.Invoke(this); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Blackjack/Player.cs b/src/NadekoBot/Modules/Gambling/Common/Blackjack/Player.cs index 3ab0e7efc..4374d6d13 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Blackjack/Player.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Blackjack/Player.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.Blackjack; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Blackjack; public abstract class Player { @@ -53,4 +54,4 @@ public class User : Player public long Bet { get; set; } public IUser DiscordUser { get; } public bool Done => State != UserState.Waiting; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/CurrencyRaffleGame.cs b/src/NadekoBot/Modules/Gambling/Common/CurrencyRaffleGame.cs index b1019e919..02e15091c 100644 --- a/src/NadekoBot/Modules/Gambling/Common/CurrencyRaffleGame.cs +++ b/src/NadekoBot/Modules/Gambling/Common/CurrencyRaffleGame.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common; public class CurrencyRaffleGame { @@ -66,4 +67,4 @@ public class CurrencyRaffleGame var usrs = _users.ToArray(); return usrs[rng.Next(0, usrs.Length)]; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Deck.cs b/src/NadekoBot/Modules/Gambling/Common/Deck.cs index 72fe5ccfe..f3d6fd04e 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Deck.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Deck.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common; public class QuadDeck : Deck { @@ -299,4 +300,4 @@ public class Deck } return "High card " + (cards.FirstOrDefault(c => c.Number == 1)?.GetValueText() ?? cards.Max().GetValueText()); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Events/EventOptions.cs b/src/NadekoBot/Modules/Gambling/Common/Events/EventOptions.cs index 77cd6640a..331380a51 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Events/EventOptions.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Events/EventOptions.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; namespace NadekoBot.Modules.Gambling.Common.Events; @@ -25,4 +26,4 @@ public class EventOptions : INadekoCommandOptions if (PotSize != 0 && PotSize < Amount) PotSize = 0; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Events/GameStatusEvent.cs b/src/NadekoBot/Modules/Gambling/Common/Events/GameStatusEvent.cs index 7d472251d..ac0381f27 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Events/GameStatusEvent.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Events/GameStatusEvent.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Gambling.Common.Events; @@ -191,4 +192,4 @@ public class GameStatusEvent : ICurrencyEvent } return true; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Events/ICurrencyEvent.cs b/src/NadekoBot/Modules/Gambling/Common/Events/ICurrencyEvent.cs index 1b4a1e1ad..9a6620eb9 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Events/ICurrencyEvent.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Events/ICurrencyEvent.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Modules.Gambling.Common; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common; public interface ICurrencyEvent { event Func OnEnded; Task StopEvent(); Task StartEvent(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Events/ReactionEvent.cs b/src/NadekoBot/Modules/Gambling/Common/Events/ReactionEvent.cs index 17079b1a1..041af7061 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Events/ReactionEvent.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Events/ReactionEvent.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Gambling.Common.Events; @@ -189,4 +190,4 @@ public class ReactionEvent : ICurrencyEvent } return true; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs b/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs index 09baf11c9..d78b06675 100644 --- a/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs +++ b/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs @@ -1,4 +1,5 @@ -using Cloneable; +#nullable disable +using Cloneable; using NadekoBot.Common.Yml; using SixLabors.ImageSharp.PixelFormats; using YamlDotNet.Serialization; @@ -308,4 +309,4 @@ public sealed partial class BetRollPair { public int WhenAbove { get; set; } public float MultiplyBy { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/GamblingError.cs b/src/NadekoBot/Modules/Gambling/Common/GamblingError.cs index 919f56695..b768a747a 100644 --- a/src/NadekoBot/Modules/Gambling/Common/GamblingError.cs +++ b/src/NadekoBot/Modules/Gambling/Common/GamblingError.cs @@ -1,7 +1,8 @@ +#nullable disable namespace NadekoBot.Modules.Gambling; public enum GamblingError { None, NotEnough -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/GamblingTopLevelModule.cs b/src/NadekoBot/Modules/Gambling/Common/GamblingTopLevelModule.cs index e58f07838..50d3b6aed 100644 --- a/src/NadekoBot/Modules/Gambling/Common/GamblingTopLevelModule.cs +++ b/src/NadekoBot/Modules/Gambling/Common/GamblingTopLevelModule.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Services; +#nullable disable +using NadekoBot.Modules.Gambling.Services; namespace NadekoBot.Modules.Gambling.Common; @@ -57,4 +58,4 @@ public abstract class GamblingSubmodule : GamblingModule protected GamblingSubmodule(GamblingConfigService gamblingConfService) : base(gamblingConfService) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Payout.cs b/src/NadekoBot/Modules/Gambling/Common/Payout.cs index 4e7b50ed4..1d405fbed 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Payout.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Payout.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Modules.Gambling.Common; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common; public class Payout { public string User { get; set; } public int Amount { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/RollDuelGame.cs b/src/NadekoBot/Modules/Gambling/Common/RollDuelGame.cs index eaf3c6296..c1ba8642d 100644 --- a/src/NadekoBot/Modules/Gambling/Common/RollDuelGame.cs +++ b/src/NadekoBot/Modules/Gambling/Common/RollDuelGame.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common; public class RollDuelGame { @@ -129,4 +130,4 @@ public struct RollDuelChallenge { public ulong Player1 { get; set; } public ulong Player2 { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Slot/SlotGame.cs b/src/NadekoBot/Modules/Gambling/Common/Slot/SlotGame.cs index 6258cd9b0..aedbeec2a 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Slot/SlotGame.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Slot/SlotGame.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.Slot; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Slot; public class SlotGame { @@ -36,4 +37,4 @@ public class SlotGame return new(multi, rolls); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/SlotResponse.cs b/src/NadekoBot/Modules/Gambling/Common/SlotResponse.cs index 680bdd980..b91d5bc39 100644 --- a/src/NadekoBot/Modules/Gambling/Common/SlotResponse.cs +++ b/src/NadekoBot/Modules/Gambling/Common/SlotResponse.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling; +#nullable disable +namespace NadekoBot.Modules.Gambling; public class SlotResponse { @@ -6,4 +7,4 @@ public class SlotResponse public long Won { get; set; } public List Rolls { get; set; } = new(); public GamblingError Error { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Waifu/AffinityTitle.cs b/src/NadekoBot/Modules/Gambling/Common/Waifu/AffinityTitle.cs index d9f308b73..84b3a7b6d 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Waifu/AffinityTitle.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Waifu/AffinityTitle.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.Waifu; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Waifu; public enum AffinityTitle { @@ -12,4 +13,4 @@ public enum AffinityTitle Sloot, Depraved, Harlot -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Waifu/ClaimTitle.cs b/src/NadekoBot/Modules/Gambling/Common/Waifu/ClaimTitle.cs index c32fb97ce..03cebe23e 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Waifu/ClaimTitle.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Waifu/ClaimTitle.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.Waifu; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Waifu; public enum ClaimTitle { @@ -14,4 +15,4 @@ public enum ClaimTitle Incubis, Harem_King, Harem_God, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Waifu/DivorceResult.cs b/src/NadekoBot/Modules/Gambling/Common/Waifu/DivorceResult.cs index e42e73c8e..3ebfddbf3 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Waifu/DivorceResult.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Waifu/DivorceResult.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.Waifu; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Waifu; public enum DivorceResult { @@ -6,4 +7,4 @@ public enum DivorceResult SucessWithPenalty, NotYourWife, Cooldown -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/Waifu/WaifuClaimResult.cs b/src/NadekoBot/Modules/Gambling/Common/Waifu/WaifuClaimResult.cs index adcb73250..fb4e14054 100644 --- a/src/NadekoBot/Modules/Gambling/Common/Waifu/WaifuClaimResult.cs +++ b/src/NadekoBot/Modules/Gambling/Common/Waifu/WaifuClaimResult.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Modules.Gambling.Common.Waifu; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.Waifu; public enum WaifuClaimResult { Success, NotEnoughFunds, InsufficientAmount -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Common/WheelOfFortune/WheelOfFortune.cs b/src/NadekoBot/Modules/Gambling/Common/WheelOfFortune/WheelOfFortune.cs index 4f8b9f39d..c8e311306 100644 --- a/src/NadekoBot/Modules/Gambling/Common/WheelOfFortune/WheelOfFortune.cs +++ b/src/NadekoBot/Modules/Gambling/Common/WheelOfFortune/WheelOfFortune.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Common.WheelOfFortune; +#nullable disable +namespace NadekoBot.Modules.Gambling.Common.WheelOfFortune; public class WheelOfFortuneGame { @@ -38,4 +39,4 @@ public class WheelOfFortuneGame Amount = amount, }; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Connect4/Connect4.cs b/src/NadekoBot/Modules/Gambling/Connect4/Connect4.cs index 36952704d..854ae0cf1 100644 --- a/src/NadekoBot/Modules/Gambling/Connect4/Connect4.cs +++ b/src/NadekoBot/Modules/Gambling/Connect4/Connect4.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; using System.Collections.Immutable; namespace NadekoBot.Modules.Gambling.Common.Connect4; @@ -388,4 +389,4 @@ public sealed class Connect4Game : IDisposable [Option('b', "bet", Required = false, Default = 0, HelpText = "Amount you bet. Default 0.")] public int Bet { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Connect4Commands.cs b/src/NadekoBot/Modules/Gambling/Connect4Commands.cs index dcc84995a..7e70a85bf 100644 --- a/src/NadekoBot/Modules/Gambling/Connect4Commands.cs +++ b/src/NadekoBot/Modules/Gambling/Connect4Commands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common; +#nullable disable +using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.Connect4; using NadekoBot.Modules.Gambling.Services; using System.Text; @@ -194,4 +195,4 @@ public partial class Gambling return sb.ToString(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs b/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs index eaeb58c4c..24d118004 100644 --- a/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs +++ b/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Services; +#nullable disable +using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common.Events; using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Gambling.Common; @@ -71,4 +72,4 @@ public partial class Gambling potSizeStr)); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs b/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs index 4029aea8a..4a8e74d37 100644 --- a/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs +++ b/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Services; +#nullable disable +using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common; namespace NadekoBot.Modules.Gambling; @@ -49,4 +50,4 @@ public partial class Gambling } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs b/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs index 27500dc8c..35303e007 100644 --- a/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs +++ b/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using System.Text.RegularExpressions; @@ -204,4 +205,4 @@ public partial class Gambling return Image.Load(_images.Dice[num]); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/DrawCommands.cs b/src/NadekoBot/Modules/Gambling/DrawCommands.cs index f6327fae3..368775b71 100644 --- a/src/NadekoBot/Modules/Gambling/DrawCommands.cs +++ b/src/NadekoBot/Modules/Gambling/DrawCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common; +#nullable disable +using NadekoBot.Modules.Gambling.Common; using Image = SixLabors.ImageSharp.Image; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; @@ -107,4 +108,4 @@ public partial class Gambling await ReplyConfirmLocalizedAsync(strs.deck_reshuffled).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs b/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs index 55cde6689..2edb7fb32 100644 --- a/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs +++ b/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Services; using SixLabors.ImageSharp; @@ -116,4 +117,4 @@ public partial class Gambling .WithImageUrl(imageToSend.ToString())).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index a33eb94ea..f8037efc5 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Modules.Gambling.Common; using NadekoBot.Db.Models; using NadekoBot.Modules.Gambling.Services; @@ -124,7 +125,7 @@ public partial class Gambling : GamblingModule [RequireContext(ContextType.Guild)] public async Task Raffle([Leftover] IRole role = null) { - role = role ?? ctx.Guild.EveryoneRole; + role ??= ctx.Guild.EveryoneRole; var members = (await role.GetMembersAsync().ConfigureAwait(false)).Where(u => u.Status != UserStatus.Offline); var membersArray = members as IUser[] ?? members.ToArray(); @@ -140,7 +141,7 @@ public partial class Gambling : GamblingModule [RequireContext(ContextType.Guild)] public async Task RaffleAny([Leftover] IRole role = null) { - role = role ?? ctx.Guild.EveryoneRole; + role ??= ctx.Guild.EveryoneRole; var members = await role.GetMembersAsync().ConfigureAwait(false); var membersArray = members as IUser[] ?? members.ToArray(); @@ -207,7 +208,7 @@ public partial class Gambling : GamblingModule [Priority(1)] public async Task Cash([Leftover] IUser user = null) { - user = user ?? ctx.User; + user ??= ctx.User; await ConfirmLocalizedAsync(strs.has(Format.Bold(user.ToString()), $"{GetCurrency(user.Id)}")); } @@ -659,4 +660,4 @@ public partial class Gambling : GamblingModule await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/PlantAndPickCommands.cs b/src/NadekoBot/Modules/Gambling/PlantAndPickCommands.cs index dc8c33ddd..48c8f7039 100644 --- a/src/NadekoBot/Modules/Gambling/PlantAndPickCommands.cs +++ b/src/NadekoBot/Modules/Gambling/PlantAndPickCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Modules.Administration.Services; using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common; @@ -111,4 +112,4 @@ public partial class Gambling }, enabledIn.Count(), 9); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/AnimalRaceService.cs b/src/NadekoBot/Modules/Gambling/Services/AnimalRaceService.cs index 6e34ff486..a7018f3fd 100644 --- a/src/NadekoBot/Modules/Gambling/Services/AnimalRaceService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/AnimalRaceService.cs @@ -1,8 +1,9 @@ -using NadekoBot.Modules.Gambling.Common.AnimalRacing; +#nullable disable +using NadekoBot.Modules.Gambling.Common.AnimalRacing; namespace NadekoBot.Modules.Gambling.Services; public class AnimalRaceService : INService { public ConcurrentDictionary AnimalRaces { get; } = new(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/BlackJackService.cs b/src/NadekoBot/Modules/Gambling/Services/BlackJackService.cs index 0e0f6dbd4..6c1f4bd4e 100644 --- a/src/NadekoBot/Modules/Gambling/Services/BlackJackService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/BlackJackService.cs @@ -1,8 +1,9 @@ -using NadekoBot.Modules.Gambling.Common.Blackjack; +#nullable disable +using NadekoBot.Modules.Gambling.Common.Blackjack; namespace NadekoBot.Modules.Gambling.Services; public class BlackJackService : INService { public ConcurrentDictionary Games { get; } = new(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/CurrencyEventsService.cs b/src/NadekoBot/Modules/Gambling/Services/CurrencyEventsService.cs index 42110f8a0..bf4a766ac 100644 --- a/src/NadekoBot/Modules/Gambling/Services/CurrencyEventsService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/CurrencyEventsService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common.Events; +#nullable disable +using NadekoBot.Modules.Gambling.Common.Events; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Services.Database.Models; @@ -69,4 +70,4 @@ public class CurrencyEventsService : INService _events.TryRemove(gid, out _); return Task.CompletedTask; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/CurrencyRaffleService.cs b/src/NadekoBot/Modules/Gambling/Services/CurrencyRaffleService.cs index 346190c2d..6daa414c6 100644 --- a/src/NadekoBot/Modules/Gambling/Services/CurrencyRaffleService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/CurrencyRaffleService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common; +#nullable disable +using NadekoBot.Modules.Gambling.Common; namespace NadekoBot.Modules.Gambling.Services; @@ -77,4 +78,4 @@ public class CurrencyRaffleService : INService _locker.Release(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs b/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs index 3274e7ecc..fb7e376cc 100644 --- a/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Configs; +#nullable disable +using NadekoBot.Common.Configs; using NadekoBot.Modules.Gambling.Common; namespace NadekoBot.Modules.Gambling.Services; @@ -75,4 +76,4 @@ public sealed class GamblingConfigService : ConfigServiceBase }); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/GamblingService.cs b/src/NadekoBot/Modules/Gambling/Services/GamblingService.cs index 88bb27658..cf7e9345a 100644 --- a/src/NadekoBot/Modules/Gambling/Services/GamblingService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/GamblingService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common; +#nullable disable +using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.Connect4; using NadekoBot.Modules.Gambling.Common.WheelOfFortune; using Newtonsoft.Json; @@ -157,4 +158,4 @@ WHERE CurrencyAmount > {config.Decay.MinThreshold} AND UserId!={_client.CurrentU public Task WheelOfFortuneSpinAsync(ulong userId, long bet) => new WheelOfFortuneGame(userId, bet, _gss.Data, _cs).SpinAsync(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/IShopService.cs b/src/NadekoBot/Modules/Gambling/Services/IShopService.cs index 65afeec15..200debb69 100644 --- a/src/NadekoBot/Modules/Gambling/Services/IShopService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/IShopService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Gambling.Services; +#nullable disable +namespace NadekoBot.Modules.Gambling.Services; public interface IShopService { @@ -37,4 +38,4 @@ public interface IShopService /// Destination index of the entry /// Whether swap was successful Task MoveEntryAsync(ulong guildId, int fromIndex, int toIndex); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/Impl/ShopService.cs b/src/NadekoBot/Modules/Gambling/Services/Impl/ShopService.cs index 076150aa9..0acd4839c 100644 --- a/src/NadekoBot/Modules/Gambling/Services/Impl/ShopService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/Impl/ShopService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Common.Collections; using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; @@ -97,4 +98,4 @@ public class ShopService : IShopService, INService await uow.SaveChangesAsync(); return true; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/PlantPickService.cs b/src/NadekoBot/Modules/Gambling/Services/PlantPickService.cs index 69a3b403c..57e03ea43 100644 --- a/src/NadekoBot/Modules/Gambling/Services/PlantPickService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/PlantPickService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using SixLabors.Fonts; using SixLabors.ImageSharp; @@ -353,4 +354,4 @@ public class PlantPickService : INService }); await uow.SaveChangesAsync(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/VoteRewardService.cs b/src/NadekoBot/Modules/Gambling/Services/VoteRewardService.cs index e93a0e611..243ecd273 100644 --- a/src/NadekoBot/Modules/Gambling/Services/VoteRewardService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/VoteRewardService.cs @@ -1,4 +1,5 @@ -using System.Text.Json; +#nullable disable +using System.Text.Json; using System.Text.Json.Serialization; using NadekoBot.Common.ModuleBehaviors; @@ -110,4 +111,4 @@ public class VoteRewardService : INService, IReadyExecutor } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/Services/WaifuService.cs b/src/NadekoBot/Modules/Gambling/Services/WaifuService.cs index 4cee8c162..a82d9e8d3 100644 --- a/src/NadekoBot/Modules/Gambling/Services/WaifuService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/WaifuService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common.Waifu; +#nullable disable +using NadekoBot.Modules.Gambling.Common.Waifu; using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; using NadekoBot.Db; @@ -504,4 +505,4 @@ public class WaifuService : INService .Select(x => new WaifuItemModel(x.ItemEmoji, (int)(x.Price * conf.Waifu.Multipliers.AllGiftPrices), x.Name, x.Negative)) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/ShopCommands.cs b/src/NadekoBot/Modules/Gambling/ShopCommands.cs index 5a05f4fcd..ee55712a3 100644 --- a/src/NadekoBot/Modules/Gambling/ShopCommands.cs +++ b/src/NadekoBot/Modules/Gambling/ShopCommands.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Common.Collections; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Services; @@ -459,4 +460,4 @@ public partial class Gambling return ""; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/SlotCommands.cs b/src/NadekoBot/Modules/Gambling/SlotCommands.cs index ba35713b3..b5a11efbf 100644 --- a/src/NadekoBot/Modules/Gambling/SlotCommands.cs +++ b/src/NadekoBot/Modules/Gambling/SlotCommands.cs @@ -1,4 +1,5 @@ -using System.Text; +#nullable disable +using System.Text; using NadekoBot.Db.Models; using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common; @@ -252,4 +253,4 @@ public partial class Gambling } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/TestGamblingService.cs b/src/NadekoBot/Modules/Gambling/TestGamblingService.cs index f2d078fa3..b8cd28f1c 100644 --- a/src/NadekoBot/Modules/Gambling/TestGamblingService.cs +++ b/src/NadekoBot/Modules/Gambling/TestGamblingService.cs @@ -1,4 +1,5 @@ -using Discord.Interactions; +#nullable disable +using Discord.Interactions; namespace NadekoBot.Modules.Gambling; @@ -7,4 +8,4 @@ public class TestGamblingService : InteractionModuleBase [SlashCommand("test", "uwu")] public async Task Test(string input1, int input2) => await RespondAsync("Bravo " + input1 + input2); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs index 0e4939b8d..0b3c7fb8e 100644 --- a/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Gambling.Common.Waifu; +#nullable disable +using NadekoBot.Modules.Gambling.Common.Waifu; using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common; @@ -354,4 +355,4 @@ public partial class Gambling } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Gambling/WheelOfFortuneCommands.cs b/src/NadekoBot/Modules/Gambling/WheelOfFortuneCommands.cs index 6dcf2d7cf..1b85c47b1 100644 --- a/src/NadekoBot/Modules/Gambling/WheelOfFortuneCommands.cs +++ b/src/NadekoBot/Modules/Gambling/WheelOfFortuneCommands.cs @@ -1,4 +1,5 @@ -using Wof = NadekoBot.Modules.Gambling.Common.WheelOfFortune.WheelOfFortuneGame; +#nullable disable +using Wof = NadekoBot.Modules.Gambling.Common.WheelOfFortune.WheelOfFortuneGame; using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Gambling.Common; using System.Collections.Immutable; @@ -54,4 +55,4 @@ public partial class Gambling 『{wofMultipliers[3]}』 『{wofMultipliers[4]}』 『{wofMultipliers[5]}』")).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/AcropobiaCommands.cs b/src/NadekoBot/Modules/Games/AcropobiaCommands.cs index b2326da61..717f3a874 100644 --- a/src/NadekoBot/Modules/Games/AcropobiaCommands.cs +++ b/src/NadekoBot/Modules/Games/AcropobiaCommands.cs @@ -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); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/CleverBotCommands.cs b/src/NadekoBot/Modules/Games/CleverBotCommands.cs index 69507e49c..160cc1b8a 100644 --- a/src/NadekoBot/Modules/Games/CleverBotCommands.cs +++ b/src/NadekoBot/Modules/Games/CleverBotCommands.cs @@ -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 } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Acrophobia/Acrophobia.cs b/src/NadekoBot/Modules/Games/Common/Acrophobia/Acrophobia.cs index 0ce426e7f..5338b8f87 100644 --- a/src/NadekoBot/Modules/Games/Common/Acrophobia/Acrophobia.cs +++ b/src/NadekoBot/Modules/Games/Common/Acrophobia/Acrophobia.cs @@ -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(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Acrophobia/AcrophobiaUser.cs b/src/NadekoBot/Modules/Games/Common/Acrophobia/AcrophobiaUser.cs index 21defce28..b2577477d 100644 --- a/src/NadekoBot/Modules/Games/Common/Acrophobia/AcrophobiaUser.cs +++ b/src/NadekoBot/Modules/Games/Common/Acrophobia/AcrophobiaUser.cs @@ -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; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotResponse.cs b/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotResponse.cs index c047f8a2b..e116d07f5 100644 --- a/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotResponse.cs +++ b/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotResponse.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotSession.cs b/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotSession.cs index aba235d01..66dcaa74d 100644 --- a/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotSession.cs +++ b/src/NadekoBot/Modules/Games/Common/ChatterBot/ChatterBotSession.cs @@ -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(res); return cbr.BotSay.Replace("
", "\n", StringComparison.InvariantCulture); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/ChatterBot/CleverbotResponse.cs b/src/NadekoBot/Modules/Games/Common/ChatterBot/CleverbotResponse.cs index dfac63b30..b45a0a1af 100644 --- a/src/NadekoBot/Modules/Games/Common/ChatterBot/CleverbotResponse.cs +++ b/src/NadekoBot/Modules/Games/Common/ChatterBot/CleverbotResponse.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/ChatterBot/IChatterBotSession.cs b/src/NadekoBot/Modules/Games/Common/ChatterBot/IChatterBotSession.cs index f8517b48f..237cb07d8 100644 --- a/src/NadekoBot/Modules/Games/Common/ChatterBot/IChatterBotSession.cs +++ b/src/NadekoBot/Modules/Games/Common/ChatterBot/IChatterBotSession.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Modules.Games.Common.ChatterBot; +#nullable disable +namespace NadekoBot.Modules.Games.Common.ChatterBot; public interface IChatterBotSession { Task Think(string input); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/ChatterBot/OfficialCleverbotSession.cs b/src/NadekoBot/Modules/Games/Common/ChatterBot/OfficialCleverbotSession.cs index 550227b50..de1ad4bf7 100644 --- a/src/NadekoBot/Modules/Games/Common/ChatterBot/OfficialCleverbotSession.cs +++ b/src/NadekoBot/Modules/Games/Common/ChatterBot/OfficialCleverbotSession.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/GamesConfig.cs b/src/NadekoBot/Modules/Games/Common/GamesConfig.cs index 9bade13a8..be31c7480 100644 --- a/src/NadekoBot/Modules/Games/Common/GamesConfig.cs +++ b/src/NadekoBot/Modules/Games/Common/GamesConfig.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/GirlRating.cs b/src/NadekoBot/Modules/Games/Common/GirlRating.cs index 75f17d1a0..fc57433e4 100644 --- a/src/NadekoBot/Modules/Games/Common/GirlRating.cs +++ b/src/NadekoBot/Modules/Games/Common/GirlRating.cs @@ -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 } }); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Hangman/DefaultHangmanSource.cs b/src/NadekoBot/Modules/Games/Common/Hangman/DefaultHangmanSource.cs index 4321128d9..8068e3926 100644 --- a/src/NadekoBot/Modules/Games/Common/Hangman/DefaultHangmanSource.cs +++ b/src/NadekoBot/Modules/Games/Common/Hangman/DefaultHangmanSource.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Hangman/HangmanGame.cs b/src/NadekoBot/Modules/Games/Common/Hangman/HangmanGame.cs index 38d57467b..489e8d8c0 100644 --- a/src/NadekoBot/Modules/Games/Common/Hangman/HangmanGame.cs +++ b/src/NadekoBot/Modules/Games/Common/Hangman/HangmanGame.cs @@ -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); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Hangman/HangmanService.cs b/src/NadekoBot/Modules/Games/Common/Hangman/HangmanService.cs index ae006fdd3..7e9d7a1a1 100644 --- a/src/NadekoBot/Modules/Games/Common/Hangman/HangmanService.cs +++ b/src/NadekoBot/Modules/Games/Common/Hangman/HangmanService.cs @@ -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); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Hangman/HangmanTerm.cs b/src/NadekoBot/Modules/Games/Common/Hangman/HangmanTerm.cs index 01c5815bd..dcc7c4f8c 100644 --- a/src/NadekoBot/Modules/Games/Common/Hangman/HangmanTerm.cs +++ b/src/NadekoBot/Modules/Games/Common/Hangman/HangmanTerm.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanService.cs b/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanService.cs index 6ec92bc28..a0046c7a7 100644 --- a/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanService.cs +++ b/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanService.cs @@ -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 StopHangman(ulong channelId); IReadOnlyCollection GetHangmanTypes(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanSource.cs b/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanSource.cs index 4b2469edc..dce34199e 100644 --- a/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanSource.cs +++ b/src/NadekoBot/Modules/Games/Common/Hangman/IHangmanSource.cs @@ -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 GetCategories(); public void Reload(); public bool GetTerm(string? category, [NotNullWhen(true)] out HangmanTerm? term); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Nunchi/Nunchi.cs b/src/NadekoBot/Modules/Games/Common/Nunchi/Nunchi.cs index 685bc39db..0fa25ad4b 100644 --- a/src/NadekoBot/Modules/Games/Common/Nunchi/Nunchi.cs +++ b/src/NadekoBot/Modules/Games/Common/Nunchi/Nunchi.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/PollRunner.cs b/src/NadekoBot/Modules/Games/Common/PollRunner.cs index d2c177078..a442b31fc 100644 --- a/src/NadekoBot/Modules/Games/Common/PollRunner.cs +++ b/src/NadekoBot/Modules/Games/Common/PollRunner.cs @@ -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; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs index 3fa41c788..1423f676c 100644 --- a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs +++ b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs index b67624084..a8f16493d 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs @@ -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(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaOptions.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaOptions.cs index 2a1e6ebc9..fdafde22b 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaOptions.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaOptions.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestion.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestion.cs index 247d058a8..32461e437 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestion.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestion.cs @@ -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()); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestionPool.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestionPool.cs index 8ae3a0ace..1e9d325b6 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestionPool.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaQuestionPool.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/TypingArticle.cs b/src/NadekoBot/Modules/Games/Common/TypingArticle.cs index 77e9abc8b..e060c750c 100644 --- a/src/NadekoBot/Modules/Games/Common/TypingArticle.cs +++ b/src/NadekoBot/Modules/Games/Common/TypingArticle.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Common/TypingGame.cs b/src/NadekoBot/Modules/Games/Common/TypingGame.cs index a2bc19562..c56bcb671 100644 --- a/src/NadekoBot/Modules/Games/Common/TypingGame.cs +++ b/src/NadekoBot/Modules/Games/Common/TypingGame.cs @@ -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; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Connect4Commands.cs b/src/NadekoBot/Modules/Games/Connect4Commands.cs index 5f282702b..a5b008f7b 100644 --- a/src/NadekoBot/Modules/Games/Connect4Commands.cs +++ b/src/NadekoBot/Modules/Games/Connect4Commands.cs @@ -1 +1,2 @@ - \ No newline at end of file +#nullable disable + diff --git a/src/NadekoBot/Modules/Games/Games.cs b/src/NadekoBot/Modules/Games/Games.cs index 28c323959..ae85e1599 100644 --- a/src/NadekoBot/Modules/Games/Games.cs +++ b/src/NadekoBot/Modules/Games/Games.cs @@ -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); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/HangmanCommands.cs b/src/NadekoBot/Modules/Games/HangmanCommands.cs index 1d68c7fd9..968a34387 100644 --- a/src/NadekoBot/Modules/Games/HangmanCommands.cs +++ b/src/NadekoBot/Modules/Games/HangmanCommands.cs @@ -1,4 +1,3 @@ -#nullable enable using NadekoBot.Modules.Games.Hangman; namespace NadekoBot.Modules.Games; @@ -74,4 +73,4 @@ public partial class Games } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/NunchiCommands.cs b/src/NadekoBot/Modules/Games/NunchiCommands.cs index d2916859c..dac446112 100644 --- a/src/NadekoBot/Modules/Games/NunchiCommands.cs +++ b/src/NadekoBot/Modules/Games/NunchiCommands.cs @@ -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()))); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/PollCommands.cs b/src/NadekoBot/Modules/Games/PollCommands.cs index 33945317e..e2a5c84b8 100644 --- a/src/NadekoBot/Modules/Games/PollCommands.cs +++ b/src/NadekoBot/Modules/Games/PollCommands.cs @@ -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(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs b/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs index 300be0eab..47bd77d49 100644 --- a/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs +++ b/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Services/GamesConfigService.cs b/src/NadekoBot/Modules/Games/Services/GamesConfigService.cs index 2d6b3ddba..701d79c7a 100644 --- a/src/NadekoBot/Modules/Games/Services/GamesConfigService.cs +++ b/src/NadekoBot/Modules/Games/Services/GamesConfigService.cs @@ -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 }); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Services/GamesService.cs b/src/NadekoBot/Modules/Games/Services/GamesService.cs index 9269b0e30..f762df469 100644 --- a/src/NadekoBot/Modules/Games/Services/GamesService.cs +++ b/src/NadekoBot/Modules/Games/Services/GamesService.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/Services/PollService.cs b/src/NadekoBot/Modules/Games/Services/PollService.cs index 43c824bdb..27014aeae 100644 --- a/src/NadekoBot/Modules/Games/Services/PollService.cs +++ b/src/NadekoBot/Modules/Games/Services/PollService.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/SpeedTypingCommands.cs b/src/NadekoBot/Modules/Games/SpeedTypingCommands.cs index e34565ce8..8fc533676 100644 --- a/src/NadekoBot/Modules/Games/SpeedTypingCommands.cs +++ b/src/NadekoBot/Modules/Games/SpeedTypingCommands.cs @@ -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); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/TicTacToeCommands.cs b/src/NadekoBot/Modules/Games/TicTacToeCommands.cs index 57ecb2f9f..5fe27f335 100644 --- a/src/NadekoBot/Modules/Games/TicTacToeCommands.cs +++ b/src/NadekoBot/Modules/Games/TicTacToeCommands.cs @@ -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 } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Games/TriviaCommands.cs b/src/NadekoBot/Modules/Games/TriviaCommands.cs index 6fd1953e2..b69a8c913 100644 --- a/src/NadekoBot/Modules/Games/TriviaCommands.cs +++ b/src/NadekoBot/Modules/Games/TriviaCommands.cs @@ -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); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Help/Common/CommandsOptions.cs b/src/NadekoBot/Modules/Help/Common/CommandsOptions.cs index 17f80d83e..f3c783084 100644 --- a/src/NadekoBot/Modules/Help/Common/CommandsOptions.cs +++ b/src/NadekoBot/Modules/Help/Common/CommandsOptions.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; namespace NadekoBot.Modules.Help.Common; @@ -18,4 +19,4 @@ public class CommandsOptions : INadekoCommandOptions { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/NadekoBot/Modules/Help/Help.cs index 84ace90ac..73a2ca34e 100644 --- a/src/NadekoBot/Modules/Help/Help.cs +++ b/src/NadekoBot/Modules/Help/Help.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Modules.Help.Common; using NadekoBot.Modules.Help.Services; using NadekoBot.Modules.Permissions.Services; @@ -425,4 +426,4 @@ internal class CommandJsonObject public string Module { get; set; } public List Options { get; set; } public string[] Requirements { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Help/Services/HelpService.cs b/src/NadekoBot/Modules/Help/Services/HelpService.cs index 556430710..d45f1b08d 100644 --- a/src/NadekoBot/Modules/Help/Services/HelpService.cs +++ b/src/NadekoBot/Modules/Help/Services/HelpService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using CommandLine; using NadekoBot.Modules.Administration.Services; @@ -163,4 +164,4 @@ public class HelpService : ILateExecutor, INService private string GetText(LocStr str, IGuild guild, params object[] replacements) => _strings.GetText(str, guild?.Id); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/ICachableTrackData.cs b/src/NadekoBot/Modules/Music/Common/ICachableTrackData.cs index a75646869..84b1d3150 100644 --- a/src/NadekoBot/Modules/Music/Common/ICachableTrackData.cs +++ b/src/NadekoBot/Modules/Music/Common/ICachableTrackData.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public interface ICachableTrackData { @@ -8,4 +9,4 @@ public interface ICachableTrackData public TimeSpan Duration { get; } MusicPlatform Platform { get; set; } string Title { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/ILocalTrackResolver.cs b/src/NadekoBot/Modules/Music/Common/ILocalTrackResolver.cs index 18f26d457..e17940493 100644 --- a/src/NadekoBot/Modules/Music/Common/ILocalTrackResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/ILocalTrackResolver.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public interface ILocalTrackResolver : IPlatformQueryResolver { IAsyncEnumerable ResolveDirectoryAsync(string dirPath); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IMusicPlayer.cs b/src/NadekoBot/Modules/Music/Common/IMusicPlayer.cs index f8b7343f9..24e9e62aa 100644 --- a/src/NadekoBot/Modules/Music/Common/IMusicPlayer.cs +++ b/src/NadekoBot/Modules/Music/Common/IMusicPlayer.cs @@ -1,6 +1,5 @@ using NadekoBot.Services.Database.Models; -#nullable enable namespace NadekoBot.Modules.Music; public interface IMusicPlayer : IDisposable @@ -32,4 +31,4 @@ public interface IMusicPlayer : IDisposable void EnqueueTracks(IEnumerable tracks, string queuer); void SetRepeat(PlayerRepeatType type); void ShuffleQueue(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IMusicQueue.cs b/src/NadekoBot/Modules/Music/Common/IMusicQueue.cs index 1a83c0f95..16431b92b 100644 --- a/src/NadekoBot/Modules/Music/Common/IMusicQueue.cs +++ b/src/NadekoBot/Modules/Music/Common/IMusicQueue.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public interface IMusicQueue { @@ -20,4 +19,4 @@ public interface IMusicQueue IQueuedTrackInfo? MoveTrack(int from, int to); void Shuffle(Random rng); bool IsLast(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IPlatformQueryResolver.cs b/src/NadekoBot/Modules/Music/Common/IPlatformQueryResolver.cs index 861d8ab2e..62a2ae032 100644 --- a/src/NadekoBot/Modules/Music/Common/IPlatformQueryResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/IPlatformQueryResolver.cs @@ -1,7 +1,6 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public interface IPlatformQueryResolver { Task ResolveByQueryAsync(string query); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IQueuedTrackInfo.cs b/src/NadekoBot/Modules/Music/Common/IQueuedTrackInfo.cs index c5fd569d2..6595084cc 100644 --- a/src/NadekoBot/Modules/Music/Common/IQueuedTrackInfo.cs +++ b/src/NadekoBot/Modules/Music/Common/IQueuedTrackInfo.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public interface IQueuedTrackInfo : ITrackInfo { public ITrackInfo TrackInfo { get; } public string Queuer { get; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IRadioResolver.cs b/src/NadekoBot/Modules/Music/Common/IRadioResolver.cs index 7a896d9d9..085f610fc 100644 --- a/src/NadekoBot/Modules/Music/Common/IRadioResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/IRadioResolver.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public interface IRadioResolver : IPlatformQueryResolver { -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/ISoundcloudResolver.cs b/src/NadekoBot/Modules/Music/Common/ISoundcloudResolver.cs index 90d8ac35b..05148dc72 100644 --- a/src/NadekoBot/Modules/Music/Common/ISoundcloudResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/ISoundcloudResolver.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public interface ISoundcloudResolver : IPlatformQueryResolver { bool IsSoundCloudLink(string url); IAsyncEnumerable ResolvePlaylistAsync(string playlist); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/ITrackCacher.cs b/src/NadekoBot/Modules/Music/Common/ITrackCacher.cs index 37f9d4ebe..ffbfd7f61 100644 --- a/src/NadekoBot/Modules/Music/Common/ITrackCacher.cs +++ b/src/NadekoBot/Modules/Music/Common/ITrackCacher.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public interface ITrackCacher { @@ -18,4 +17,4 @@ public interface ITrackCacher Task CachePlaylistTrackIdsAsync(string playlistId, MusicPlatform platform, IEnumerable ids); Task CachePlaylistIdByQueryAsync(string query, MusicPlatform platform, string playlistId); Task GetPlaylistIdByQueryAsync(string query, MusicPlatform platform); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/ITrackInfo.cs b/src/NadekoBot/Modules/Music/Common/ITrackInfo.cs index 80853b8c5..efed1e1ad 100644 --- a/src/NadekoBot/Modules/Music/Common/ITrackInfo.cs +++ b/src/NadekoBot/Modules/Music/Common/ITrackInfo.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public interface ITrackInfo { @@ -9,4 +8,4 @@ public interface ITrackInfo public TimeSpan Duration { get; } public MusicPlatform Platform { get; } public ValueTask GetStreamUrl(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/ITrackResolveProvider.cs b/src/NadekoBot/Modules/Music/Common/ITrackResolveProvider.cs index 9514eb3a2..1a7ce5410 100644 --- a/src/NadekoBot/Modules/Music/Common/ITrackResolveProvider.cs +++ b/src/NadekoBot/Modules/Music/Common/ITrackResolveProvider.cs @@ -1,7 +1,6 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public interface ITrackResolveProvider { Task QuerySongAsync(string query, MusicPlatform? forcePlatform); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IVoiceProxy.cs b/src/NadekoBot/Modules/Music/Common/IVoiceProxy.cs index 3f366b629..0160e5078 100644 --- a/src/NadekoBot/Modules/Music/Common/IVoiceProxy.cs +++ b/src/NadekoBot/Modules/Music/Common/IVoiceProxy.cs @@ -1,4 +1,5 @@ -using Ayu.Discord.Voice; +#nullable disable +using Ayu.Discord.Voice; namespace NadekoBot.Modules.Music; @@ -11,4 +12,4 @@ public interface IVoiceProxy Task StopSpeakingAsync(); public Task StartGateway(); Task StopGateway(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/IYoutubeResolver.cs b/src/NadekoBot/Modules/Music/Common/IYoutubeResolver.cs index 5efb2bfcc..103cbb6f1 100644 --- a/src/NadekoBot/Modules/Music/Common/IYoutubeResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/IYoutubeResolver.cs @@ -1,5 +1,4 @@ -#nullable enable -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; namespace NadekoBot.Modules.Music; @@ -9,4 +8,4 @@ public interface IYoutubeResolver : IPlatformQueryResolver public Task ResolveByIdAsync(string id); IAsyncEnumerable ResolveTracksFromPlaylistAsync(string query); Task ResolveByQueryAsync(string query, bool tryExtractingId); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/CachableTrackData.cs b/src/NadekoBot/Modules/Music/Common/Impl/CachableTrackData.cs index 7d60be986..9ac80cff5 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/CachableTrackData.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/CachableTrackData.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +#nullable disable +using System.Text.Json.Serialization; namespace NadekoBot.Modules.Music; @@ -12,4 +13,4 @@ public sealed class CachableTrackData : ICachableTrackData [JsonIgnore] public TimeSpan Duration => TimeSpan.FromMilliseconds(TotalDurationMs); public MusicPlatform Platform { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/MultimediaTimer.cs b/src/NadekoBot/Modules/Music/Common/Impl/MultimediaTimer.cs index d43ffec83..7aaf571b9 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/MultimediaTimer.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/MultimediaTimer.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +#nullable disable +using System.Runtime.InteropServices; namespace NadekoBot.Modules.Music.Common; @@ -84,4 +85,4 @@ public sealed class MultimediaTimer : IDisposable _lpTimeProc = default; timeKillEvent(_eventId); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/MusicExtensions.cs b/src/NadekoBot/Modules/Music/Common/Impl/MusicExtensions.cs index 2292f31c4..e9005f3ca 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/MusicExtensions.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/MusicExtensions.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public static class MusicExtensions { @@ -53,4 +54,4 @@ public static class MusicExtensions Platform = trackInfo.Platform, Title = trackInfo.Title }; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/MusicPlatform.cs b/src/NadekoBot/Modules/Music/Common/Impl/MusicPlatform.cs index 3005fb467..22d64948f 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/MusicPlatform.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/MusicPlatform.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Music; +#nullable disable +namespace NadekoBot.Modules.Music; public enum MusicPlatform { @@ -6,4 +7,4 @@ public enum MusicPlatform Youtube, Local, SoundCloud, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/MusicPlayer.cs b/src/NadekoBot/Modules/Music/Common/Impl/MusicPlayer.cs index ec21ea499..b7a8b144f 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/MusicPlayer.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/MusicPlayer.cs @@ -1,4 +1,3 @@ -#nullable enable using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; @@ -369,7 +368,7 @@ public sealed class MusicPlayer : IMusicPlayer for (var i = 0; i < samples.Length; i++) { ref var sample = ref samples[i]; - sample = sample * volume; + sample *= volume; } } @@ -516,4 +515,4 @@ public sealed class MusicPlayer : IMusicPlayer public event Func? OnCompleted; public event Func? OnStarted; public event Func? OnQueueStopped; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/MusicQueue.cs b/src/NadekoBot/Modules/Music/Common/Impl/MusicQueue.cs index a8ac9c6b0..09b5c8ac5 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/MusicQueue.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/MusicQueue.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public sealed partial class MusicQueue { @@ -314,4 +313,4 @@ public sealed partial class MusicQueue : IMusicQueue return true; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/RedisTrackCacher.cs b/src/NadekoBot/Modules/Music/Common/Impl/RedisTrackCacher.cs index 33a54623d..eadc3f19b 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/RedisTrackCacher.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/RedisTrackCacher.cs @@ -1,5 +1,4 @@ -#nullable enable -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using System.Text.Json; using StackExchange.Redis; @@ -202,4 +201,4 @@ public sealed class RedisTrackCacher : ITrackCacher return val; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/RemoteTrackInfo.cs b/src/NadekoBot/Modules/Music/Common/Impl/RemoteTrackInfo.cs index 1a4cf53fe..c2255c5b2 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/RemoteTrackInfo.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/RemoteTrackInfo.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public sealed class RemoteTrackInfo : ITrackInfo { @@ -23,4 +22,4 @@ public sealed class RemoteTrackInfo : ITrackInfo } public async ValueTask GetStreamUrl() => await _streamFactory(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/SimpleTrackInfo.cs b/src/NadekoBot/Modules/Music/Common/Impl/SimpleTrackInfo.cs index 3eeb8b208..dfe9874fd 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/SimpleTrackInfo.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/SimpleTrackInfo.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public sealed class SimpleTrackInfo : ITrackInfo { @@ -21,4 +20,4 @@ public sealed class SimpleTrackInfo : ITrackInfo Platform = platform; StreamUrl = streamUrl; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Impl/VoiceProxy.cs b/src/NadekoBot/Modules/Music/Common/Impl/VoiceProxy.cs index f497a3cad..418912d03 100644 --- a/src/NadekoBot/Modules/Music/Common/Impl/VoiceProxy.cs +++ b/src/NadekoBot/Modules/Music/Common/Impl/VoiceProxy.cs @@ -1,4 +1,5 @@ -using Ayu.Discord.Voice; +#nullable disable +using Ayu.Discord.Voice; using Ayu.Discord.Voice.Models; namespace NadekoBot.Modules.Music; @@ -102,4 +103,4 @@ public sealed class VoiceProxy : IVoiceProxy return Task.CompletedTask; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Resolvers/LocalTrackResolver.cs b/src/NadekoBot/Modules/Music/Common/Resolvers/LocalTrackResolver.cs index b38724c56..554af8d44 100644 --- a/src/NadekoBot/Modules/Music/Common/Resolvers/LocalTrackResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/Resolvers/LocalTrackResolver.cs @@ -2,7 +2,6 @@ using System.Diagnostics; using System.Text; -#nullable enable namespace NadekoBot.Modules.Music.Resolvers; public sealed class LocalTrackResolver : ILocalTrackResolver @@ -121,4 +120,4 @@ public static class Ffprobe return TimeSpan.Zero; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Resolvers/RadioResolveStrategy.cs b/src/NadekoBot/Modules/Music/Common/Resolvers/RadioResolveStrategy.cs index 39d5bf27a..52dbc99d9 100644 --- a/src/NadekoBot/Modules/Music/Common/Resolvers/RadioResolveStrategy.cs +++ b/src/NadekoBot/Modules/Music/Common/Resolvers/RadioResolveStrategy.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +#nullable disable +using System.Text.RegularExpressions; namespace NadekoBot.Modules.Music.Resolvers; @@ -123,4 +124,4 @@ public class RadioResolver : IRadioResolver return query; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Resolvers/SoundcloudResolver.cs b/src/NadekoBot/Modules/Music/Common/Resolvers/SoundcloudResolver.cs index 1af373f0f..cc0ee4006 100644 --- a/src/NadekoBot/Modules/Music/Common/Resolvers/SoundcloudResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/Resolvers/SoundcloudResolver.cs @@ -1,7 +1,6 @@ using System.Runtime.CompilerServices; using Newtonsoft.Json.Linq; -#nullable enable namespace NadekoBot.Modules.Music.Resolvers; public sealed class SoundcloudResolver : ISoundcloudResolver @@ -89,4 +88,4 @@ public sealed class SoundcloudResolver : ISoundcloudResolver return CachableDataToTrackInfo(cachableData); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Resolvers/TrackResolveProvider.cs b/src/NadekoBot/Modules/Music/Common/Resolvers/TrackResolveProvider.cs index 630859f5e..931a0019b 100644 --- a/src/NadekoBot/Modules/Music/Common/Resolvers/TrackResolveProvider.cs +++ b/src/NadekoBot/Modules/Music/Common/Resolvers/TrackResolveProvider.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Modules.Music; +namespace NadekoBot.Modules.Music; public sealed class TrackResolveProvider : ITrackResolveProvider { @@ -55,4 +54,4 @@ public sealed class TrackResolveProvider : ITrackResolveProvider query.Contains(".m3u") || query.Contains(".asx") || query.Contains(".xspf")); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Common/Resolvers/YtdlYoutubeResolver.cs b/src/NadekoBot/Modules/Music/Common/Resolvers/YtdlYoutubeResolver.cs index 899602ce1..466429c5c 100644 --- a/src/NadekoBot/Modules/Music/Common/Resolvers/YtdlYoutubeResolver.cs +++ b/src/NadekoBot/Modules/Music/Common/Resolvers/YtdlYoutubeResolver.cs @@ -1,5 +1,4 @@ -#nullable enable -using System.Globalization; +using System.Globalization; using System.Text.RegularExpressions; namespace NadekoBot.Modules.Music; @@ -341,4 +340,4 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver cachedData.Duration )); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index a33f783e1..b9b6ffde4 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Administration.Services; using NadekoBot.Modules.Music.Services; @@ -758,4 +759,4 @@ public sealed partial class Music : NadekoModule await _service.SetMusicQualityAsync(ctx.Guild.Id, preset); await ReplyConfirmLocalizedAsync(strs.music_quality_set(Format.Bold(preset.ToString()))); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/PlaylistCommands.cs b/src/NadekoBot/Modules/Music/PlaylistCommands.cs index 6f180bf2e..b8ed72ba0 100644 --- a/src/NadekoBot/Modules/Music/PlaylistCommands.cs +++ b/src/NadekoBot/Modules/Music/PlaylistCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Db; using NadekoBot.Modules.Music.Services; @@ -232,4 +233,4 @@ public sealed partial class Music } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Services/AyuVoiceStateService.cs b/src/NadekoBot/Modules/Music/Services/AyuVoiceStateService.cs index 3beef1b75..433e84e00 100644 --- a/src/NadekoBot/Modules/Music/Services/AyuVoiceStateService.cs +++ b/src/NadekoBot/Modules/Music/Services/AyuVoiceStateService.cs @@ -1,4 +1,5 @@ -using System.Reflection; +#nullable disable +using System.Reflection; using Ayu.Discord.Voice; namespace NadekoBot.Modules.Music.Services; @@ -211,4 +212,4 @@ public sealed class AyuVoiceStateService : INService public bool TryGetProxy(ulong guildId, out IVoiceProxy proxy) => _voiceProxies.TryGetValue(guildId, out proxy); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Services/IMusicService.cs b/src/NadekoBot/Modules/Music/Services/IMusicService.cs index 624137078..9405e8760 100644 --- a/src/NadekoBot/Modules/Music/Services/IMusicService.cs +++ b/src/NadekoBot/Modules/Music/Services/IMusicService.cs @@ -1,5 +1,4 @@ -#nullable enable -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Music.Services; @@ -33,4 +32,4 @@ public interface IMusicService : IPlaceholderProvider Task ToggleAutoDisconnectAsync(ulong guildId); Task GetMusicQualityAsync(ulong guildId); Task SetMusicQualityAsync(ulong guildId, QualityPreset preset); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Services/MusicService.cs b/src/NadekoBot/Modules/Music/Services/MusicService.cs index 8bc56cf22..9c99cdc40 100644 --- a/src/NadekoBot/Modules/Music/Services/MusicService.cs +++ b/src/NadekoBot/Modules/Music/Services/MusicService.cs @@ -1,5 +1,4 @@ -#nullable enable -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -444,4 +443,4 @@ public sealed class MusicService : IMusicService }, preset); #endregion -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Services/extractor/Misc.cs b/src/NadekoBot/Modules/Music/Services/extractor/Misc.cs index bb5e39e35..f545d30bf 100644 --- a/src/NadekoBot/Modules/Music/Services/extractor/Misc.cs +++ b/src/NadekoBot/Modules/Music/Services/extractor/Misc.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Music.Services; +#nullable disable +namespace NadekoBot.Modules.Music.Services; public sealed partial class YtLoader { @@ -68,4 +69,4 @@ public sealed partial class YtLoader _videoId = videoId; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Music/Services/extractor/YtLoader.cs b/src/NadekoBot/Modules/Music/Services/extractor/YtLoader.cs index 0f8913aa0..316847df5 100644 --- a/src/NadekoBot/Modules/Music/Services/extractor/YtLoader.cs +++ b/src/NadekoBot/Modules/Music/Services/extractor/YtLoader.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; using System.Text; using System.Text.Json; @@ -126,4 +127,4 @@ public sealed partial class YtLoader endIndex - startIndex ); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Booru.cs b/src/NadekoBot/Modules/Nsfw/Common/Booru.cs index c2378f1a6..c32be45dc 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Booru.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Booru.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public enum Booru { @@ -11,4 +12,4 @@ public enum Booru Yandere, Danbooru, Sankaku -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/DapiImageObject.cs b/src/NadekoBot/Modules/Nsfw/Common/DapiImageObject.cs index 8738369ee..68c0890b4 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/DapiImageObject.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/DapiImageObject.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +#nullable disable +using System.Text.Json.Serialization; namespace NadekoBot.Modules.Nsfw.Common; @@ -14,4 +15,4 @@ public class DapiImageObject : IImageData public ImageData ToCachedImageData(Booru type) => new(this.FileUrl, type, this.Tags?.Split(' ') ?? this.TagString?.Split(' '), Score.ToString() ?? Rating); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/DapiTag.cs b/src/NadekoBot/Modules/Nsfw/Common/DapiTag.cs index 2f044c1d3..446a0298b 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/DapiTag.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/DapiTag.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +#nullable disable +using System.Text.Json.Serialization; namespace NadekoBot.Modules.Nsfw.Common; @@ -9,4 +10,4 @@ public readonly struct DapiTag [JsonConstructor] public DapiTag(string name) => Name = name; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/DerpiContainer.cs b/src/NadekoBot/Modules/Nsfw/Common/DerpiContainer.cs index 58f825f9e..e68abc201 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/DerpiContainer.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/DerpiContainer.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +#nullable disable +using System.Text.Json.Serialization; namespace NadekoBot.Modules.Nsfw.Common; @@ -15,4 +16,4 @@ public class DerpiImageObject : IImageData public int Score { get; set; } public ImageData ToCachedImageData(Booru type) => new(ViewUrl, type, Tags, Score.ToString("F1")); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DanbooruImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DanbooruImageDownloader.cs index 35db6808f..7492a3aab 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DanbooruImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DanbooruImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -33,4 +34,4 @@ public sealed class DanbooruImageDownloader : DapiImageDownloader : base(Booru.Danbooru, http, "http://danbooru.donmai.us") { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DapiImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DapiImageDownloader.cs index 382e048fd..455ffa98a 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DapiImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DapiImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -45,4 +46,4 @@ public abstract class DapiImageDownloader : ImageDownloader .Where(x => x.FileUrl is not null) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DerpibooruImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DerpibooruImageDownloader.cs index f6c44a9d9..6955e025d 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DerpibooruImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/DerpibooruImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -25,4 +26,4 @@ public class DerpibooruImageDownloader : ImageDownloader .Where(x => !string.IsNullOrWhiteSpace(x.ViewUrl)) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621ImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621ImageDownloader.cs index 35f02996a..fbec20b08 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621ImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621ImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -25,4 +26,4 @@ public class E621ImageDownloader : ImageDownloader .Where(x => !string.IsNullOrWhiteSpace(x.File?.Url)) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621Response.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621Response.cs index b4d87c3b7..b7c7f6065 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621Response.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/E621Response.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public class E621Response { public List Posts { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/GelbooruImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/GelbooruImageDownloader.cs index 3ae8a0b23..d21b1e6bf 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/GelbooruImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/GelbooruImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Text.Json; +#nullable disable +using System.Text.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -26,4 +27,4 @@ public class GelbooruImageDownloader : ImageDownloader return images.Where(x => x.FileUrl is not null).ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/IImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/IImageDownloader.cs index cbc2d26a5..968927135 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/IImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/IImageDownloader.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public interface IImageDownloader { Task> DownloadImageDataAsync(string[] tags, int page = 0, bool isExplicit = false, CancellationToken cancel = default); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloader.cs index c90b98e34..09632b9c6 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Text.Json; +#nullable disable +using System.Text.Json; using System.Text.Json.Serialization; namespace NadekoBot.Modules.Nsfw.Common; @@ -31,4 +32,4 @@ public abstract class ImageDownloader : IImageDownloader var images = await DownloadImagesAsync(tags, page, isExplicit, cancel).ConfigureAwait(false); return images.Select(x => x.ToCachedImageData(Booru)).ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloaderHelper.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloaderHelper.cs index 854353204..c9679466d 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloaderHelper.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/ImageDownloaderHelper.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public static class ImageDownloaderHelper { @@ -9,4 +10,4 @@ public static class ImageDownloaderHelper return string.Join('+', tags.Select(x => x.ToLowerInvariant())); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/KonachanImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/KonachanImageDownloader.cs index f912a7c26..9a40a9382 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/KonachanImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/KonachanImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -22,4 +23,4 @@ public sealed class KonachanImageDownloader : ImageDownloader .Where(x => x.FileUrl is not null) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/Rule34ImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/Rule34ImageDownloader.cs index c5910784a..dc100c987 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/Rule34ImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/Rule34ImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -22,4 +23,4 @@ public class Rule34ImageDownloader : ImageDownloader .Where(img => !string.IsNullOrWhiteSpace(img.Image)) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SafebooruImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SafebooruImageDownloader.cs index f216e3719..749806394 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SafebooruImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SafebooruImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -18,4 +19,4 @@ public class SafebooruImageDownloader : ImageDownloader return images; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SankakuImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SankakuImageDownloader.cs index 35997cd0a..6e073082d 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SankakuImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/SankakuImageDownloader.cs @@ -1,3 +1,4 @@ +#nullable disable using System.Text.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -24,4 +25,4 @@ public sealed class SankakuImageDownloader : ImageDownloader .Where(x => !string.IsNullOrWhiteSpace(x.FileUrl) && x.FileType.StartsWith("image")) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/YandereImageDownloader.cs b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/YandereImageDownloader.cs index 8fb347727..06c36be8e 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Downloaders/YandereImageDownloader.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Downloaders/YandereImageDownloader.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Json; +#nullable disable +using System.Net.Http.Json; namespace NadekoBot.Modules.Nsfw.Common; @@ -23,4 +24,4 @@ public sealed class YandereImageDownloader : ImageDownloader .Where(x => x.FileUrl is not null) .ToList(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/E621Object.cs b/src/NadekoBot/Modules/Nsfw/Common/E621Object.cs index 5ff0f5f6f..51af105dd 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/E621Object.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/E621Object.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public class E621Object : IImageData { @@ -23,4 +24,4 @@ public class E621Object : IImageData public ImageData ToCachedImageData(Booru type) => new(File.Url, Booru.E621, Tags.General, Score.Total.ToString()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/IImageData.cs b/src/NadekoBot/Modules/Nsfw/Common/IImageData.cs index b0ff40882..91bce6420 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/IImageData.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/IImageData.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public interface IImageData { ImageData ToCachedImageData(Booru type); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/ImageData.cs b/src/NadekoBot/Modules/Nsfw/Common/ImageData.cs index 6dad3942d..dded492c8 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/ImageData.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/ImageData.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public class ImageData : IComparable { @@ -33,4 +34,4 @@ public class ImageData : IComparable public int CompareTo(ImageData other) => string.Compare(FileUrl, other.FileUrl, StringComparison.InvariantCulture); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/Rule34Object.cs b/src/NadekoBot/Modules/Nsfw/Common/Rule34Object.cs index 0b05bbaf6..429a5d947 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/Rule34Object.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/Rule34Object.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public class Rule34Object : IImageData { @@ -13,4 +14,4 @@ public class Rule34Object : IImageData Booru.Rule34, Tags.Split(' '), Score.ToString()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/SafebooruElement.cs b/src/NadekoBot/Modules/Nsfw/Common/SafebooruElement.cs index 79b36cbe0..20732b24a 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/SafebooruElement.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/SafebooruElement.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw.Common; +#nullable disable +namespace NadekoBot.Modules.Nsfw.Common; public class SafebooruElement : IImageData { @@ -10,4 +11,4 @@ public class SafebooruElement : IImageData public string Rating { get; set; } public string Tags { get; set; } public ImageData ToCachedImageData(Booru type) => new(FileUrl, Booru.Safebooru, this.Tags.Split(' '), Rating); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Common/SankakuImageObject.cs b/src/NadekoBot/Modules/Nsfw/Common/SankakuImageObject.cs index 084afd244..ff9ff0a58 100644 --- a/src/NadekoBot/Modules/Nsfw/Common/SankakuImageObject.cs +++ b/src/NadekoBot/Modules/Nsfw/Common/SankakuImageObject.cs @@ -1,3 +1,4 @@ +#nullable disable using System.Text.Json.Serialization; namespace NadekoBot.Modules.Nsfw.Common; @@ -22,4 +23,4 @@ public class SankakuImageObject : IImageData public ImageData ToCachedImageData(Nsfw.Common.Booru type) => new(FileUrl, Nsfw.Common.Booru.Sankaku, Tags.Select(x => x.Name).ToArray(), Score.ToString()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/ISearchImagesService.cs b/src/NadekoBot/Modules/Nsfw/ISearchImagesService.cs index 302adb305..0e3ac06dd 100644 --- a/src/NadekoBot/Modules/Nsfw/ISearchImagesService.cs +++ b/src/NadekoBot/Modules/Nsfw/ISearchImagesService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Common; +#nullable disable +using NadekoBot.Modules.Searches.Common; namespace NadekoBot.Modules.Nsfw; @@ -23,4 +24,4 @@ public interface ISearchImagesService ConcurrentDictionary AutoHentaiTimers { get; } ConcurrentDictionary AutoBoobTimers { get; } ConcurrentDictionary AutoButtTimers { get; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/Nsfw.cs b/src/NadekoBot/Modules/Nsfw/Nsfw.cs index 1577f96a9..6fc97fb48 100644 --- a/src/NadekoBot/Modules/Nsfw/Nsfw.cs +++ b/src/NadekoBot/Modules/Nsfw/Nsfw.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Common; +#nullable disable +using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json.Linq; namespace NadekoBot.Modules.Nsfw; @@ -410,4 +411,4 @@ public class NSFW : NadekoModule .WithDescription($"[link]({data.Url})") .WithFooter($"{data.Rating} ({data.Provider}) | {string.Join(" | ", data.Tags.Where(x => !string.IsNullOrWhiteSpace(x)).Take(5))}")); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/NsfwService.cs b/src/NadekoBot/Modules/Nsfw/NsfwService.cs index 797ddda1a..74a5ca4ae 100644 --- a/src/NadekoBot/Modules/Nsfw/NsfwService.cs +++ b/src/NadekoBot/Modules/Nsfw/NsfwService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Nsfw; +#nullable disable +namespace NadekoBot.Modules.Nsfw; public interface INsfwService { @@ -8,4 +9,4 @@ public interface INsfwService public class NsfwService { -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/SearchImageCacher.cs b/src/NadekoBot/Modules/Nsfw/SearchImageCacher.cs index 809a42a0c..af8d3e786 100644 --- a/src/NadekoBot/Modules/Nsfw/SearchImageCacher.cs +++ b/src/NadekoBot/Modules/Nsfw/SearchImageCacher.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Caching.Memory; +#nullable disable +using Microsoft.Extensions.Caching.Memory; namespace NadekoBot.Modules.Nsfw.Common; @@ -313,4 +314,4 @@ public class SearchImageCacher : INService return new(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Nsfw/SearchImagesService.cs b/src/NadekoBot/Modules/Nsfw/SearchImagesService.cs index 83f408cc9..8b11ea60f 100644 --- a/src/NadekoBot/Modules/Nsfw/SearchImagesService.cs +++ b/src/NadekoBot/Modules/Nsfw/SearchImagesService.cs @@ -1,3 +1,4 @@ +#nullable disable using Newtonsoft.Json.Linq; using LinqToDB; using NadekoBot.Modules.Searches.Common; @@ -375,4 +376,4 @@ public class SearchImagesService : ISearchImagesService, INService return ModelToGallery(models[_rng.Next(0, models.Length)]); } #endregion -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/BlacklistCommands.cs b/src/NadekoBot/Modules/Permissions/BlacklistCommands.cs index 4e25618c6..1a6854e97 100644 --- a/src/NadekoBot/Modules/Permissions/BlacklistCommands.cs +++ b/src/NadekoBot/Modules/Permissions/BlacklistCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders; +#nullable disable +using NadekoBot.Common.TypeReaders; using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Permissions.Services; @@ -142,4 +143,4 @@ public partial class Permissions Format.Code(id.ToString()))); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/CmdCdsCommands.cs b/src/NadekoBot/Modules/Permissions/CmdCdsCommands.cs index 79d540b61..dc7a9afc2 100644 --- a/src/NadekoBot/Modules/Permissions/CmdCdsCommands.cs +++ b/src/NadekoBot/Modules/Permissions/CmdCdsCommands.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Common.TypeReaders; using NadekoBot.Db; @@ -85,4 +86,4 @@ public partial class Permissions await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + GetText(strs.sec)), s => $"{s,-30}", 2).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Common/PermissionCache.cs b/src/NadekoBot/Modules/Permissions/Common/PermissionCache.cs index f3fca3439..63bb3bb0a 100644 --- a/src/NadekoBot/Modules/Permissions/Common/PermissionCache.cs +++ b/src/NadekoBot/Modules/Permissions/Common/PermissionCache.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Permissions.Common; @@ -7,4 +8,4 @@ public class PermissionCache public string PermRole { get; set; } public bool Verbose { get; set; } = true; public PermissionsCollection Permissions { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Common/PermissionExtensions.cs b/src/NadekoBot/Modules/Permissions/Common/PermissionExtensions.cs index 6442cb088..59929ad2e 100644 --- a/src/NadekoBot/Modules/Permissions/Common/PermissionExtensions.cs +++ b/src/NadekoBot/Modules/Permissions/Common/PermissionExtensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Permissions.Common; @@ -117,4 +118,4 @@ public static class PermissionExtensions return prefix + com; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Common/PermissionsCollection.cs b/src/NadekoBot/Modules/Permissions/Common/PermissionsCollection.cs index 6703f9877..eb1fc4d10 100644 --- a/src/NadekoBot/Modules/Permissions/Common/PermissionsCollection.cs +++ b/src/NadekoBot/Modules/Permissions/Common/PermissionsCollection.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Collections; +#nullable disable +using NadekoBot.Common.Collections; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Permissions.Common; @@ -67,4 +68,4 @@ public class PermissionsCollection : IndexedCollection where T : class, II } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/FilterCommands.cs b/src/NadekoBot/Modules/Permissions/FilterCommands.cs index 4aa035541..4b253de5f 100644 --- a/src/NadekoBot/Modules/Permissions/FilterCommands.cs +++ b/src/NadekoBot/Modules/Permissions/FilterCommands.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Modules.Permissions.Services; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -283,4 +284,4 @@ public partial class Permissions , fws.Length, 10).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs b/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs index 2f3b938db..d17d87aa7 100644 --- a/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs +++ b/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.TypeReaders; +#nullable disable +using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Permissions.Services; namespace NadekoBot.Modules.Permissions; @@ -77,4 +78,4 @@ public partial class Permissions await ReplyConfirmLocalizedAsync(strs.gcmd_remove(Format.Bold(cmd.Name))).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Permissions.cs b/src/NadekoBot/Modules/Permissions/Permissions.cs index 81e657f5f..19d79ab77 100644 --- a/src/NadekoBot/Modules/Permissions/Permissions.cs +++ b/src/NadekoBot/Modules/Permissions/Permissions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Common.TypeReaders; using NadekoBot.Common.TypeReaders.Models; using NadekoBot.Db; @@ -560,4 +561,4 @@ public partial class Permissions : NadekoModule await ReplyConfirmLocalizedAsync(strs.asm_disable).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs b/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs index 297037491..7cc336cbd 100644 --- a/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs +++ b/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Permissions.Services; +#nullable disable +using NadekoBot.Modules.Permissions.Services; namespace NadekoBot.Modules.Permissions; @@ -33,4 +34,4 @@ public partial class Permissions await ReplyConfirmLocalizedAsync(strs.global_perms_reset).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Services/BlacklistService.cs b/src/NadekoBot/Modules/Permissions/Services/BlacklistService.cs index 378acf246..e293c24bd 100644 --- a/src/NadekoBot/Modules/Permissions/Services/BlacklistService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/BlacklistService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; using NadekoBot.Db; @@ -126,4 +127,4 @@ public sealed class BlacklistService : IEarlyBehavior Reload(true); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Services/CmdCdService.cs b/src/NadekoBot/Modules/Permissions/Services/CmdCdService.cs index c7a279297..5ffa8950e 100644 --- a/src/NadekoBot/Modules/Permissions/Services/CmdCdService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/CmdCdService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Permissions.Services; @@ -67,4 +68,4 @@ public class ActiveCooldown { public string Command { get; set; } public ulong UserId { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Services/FilterService.cs b/src/NadekoBot/Modules/Permissions/Services/FilterService.cs index 7c4d2b00e..3722b38a1 100644 --- a/src/NadekoBot/Modules/Permissions/Services/FilterService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/FilterService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -216,4 +217,4 @@ public sealed class FilterService : IEarlyBehavior } return false; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Services/GlobalPermissionService.cs b/src/NadekoBot/Modules/Permissions/Services/GlobalPermissionService.cs index a4fcd1e9b..10565919e 100644 --- a/src/NadekoBot/Modules/Permissions/Services/GlobalPermissionService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/GlobalPermissionService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; namespace NadekoBot.Modules.Permissions.Services; @@ -90,4 +91,4 @@ public class GlobalPermissionService : ILateBlocker, INService return Task.CompletedTask; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs b/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs index b1ef8493f..8bbbba3f6 100644 --- a/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Modules.Permissions.Common; using NadekoBot.Services.Database.Models; @@ -170,4 +171,4 @@ public class PermissionService : ILateBlocker, INService await uow.SaveChangesAsync(); UpdateCache(config); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs index cbdbe8343..b60bc3399 100644 --- a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs @@ -1,4 +1,5 @@ -using AngleSharp; +#nullable disable +using AngleSharp; using NadekoBot.Modules.Searches.Services; using AngleSharp.Html.Dom; @@ -184,4 +185,4 @@ public partial class Searches await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/AnimeResult.cs b/src/NadekoBot/Modules/Searches/Common/AnimeResult.cs index c1696281f..a9290c741 100644 --- a/src/NadekoBot/Modules/Searches/Common/AnimeResult.cs +++ b/src/NadekoBot/Modules/Searches/Common/AnimeResult.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -21,4 +22,4 @@ public class AnimeResult public string Link => "http://anilist.co/anime/" + Id; public string Synopsis => Description?[..(Description.Length > 500 ? 500 : Description.Length)] + "..."; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/BibleVerses.cs b/src/NadekoBot/Modules/Searches/Common/BibleVerses.cs index 780ab59ea..314babdab 100644 --- a/src/NadekoBot/Modules/Searches/Common/BibleVerses.cs +++ b/src/NadekoBot/Modules/Searches/Common/BibleVerses.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -15,4 +16,4 @@ public class BibleVerse public int Chapter { get; set; } public int Verse { get; set; } public string Text { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/CryptoData.cs b/src/NadekoBot/Modules/Searches/Common/CryptoData.cs index eefc703b4..84bf5aca7 100644 --- a/src/NadekoBot/Modules/Searches/Common/CryptoData.cs +++ b/src/NadekoBot/Modules/Searches/Common/CryptoData.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -32,4 +33,4 @@ public class Quote public string Percent_Change_24h { get; set; } public string Percent_Change_7d { get; set; } public double? Volume_24h { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/DefineModel.cs b/src/NadekoBot/Modules/Searches/Common/DefineModel.cs index 6f44fdbd8..059461c34 100644 --- a/src/NadekoBot/Modules/Searches/Common/DefineModel.cs +++ b/src/NadekoBot/Modules/Searches/Common/DefineModel.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -37,4 +38,4 @@ public class Result public class DefineModel { public List Results { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/E621Object.cs b/src/NadekoBot/Modules/Searches/Common/E621Object.cs index 5f1b01c25..f66c6b0df 100644 --- a/src/NadekoBot/Modules/Searches/Common/E621Object.cs +++ b/src/NadekoBot/Modules/Searches/Common/E621Object.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class E621Object { @@ -20,4 +21,4 @@ public class E621Object public FileData File { get; set; } public TagData Tags { get; set; } public ScoreData Score { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/Exceptions/StreamNotFoundException.cs b/src/NadekoBot/Modules/Searches/Common/Exceptions/StreamNotFoundException.cs index b83511342..27eac5baf 100644 --- a/src/NadekoBot/Modules/Searches/Common/Exceptions/StreamNotFoundException.cs +++ b/src/NadekoBot/Modules/Searches/Common/Exceptions/StreamNotFoundException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Searches.Common.Exceptions; public class StreamNotFoundException : Exception { @@ -13,4 +14,4 @@ public class StreamNotFoundException : Exception public StreamNotFoundException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/Gallery.cs b/src/NadekoBot/Modules/Searches/Common/Gallery.cs index b4e7ea08e..3270da4fa 100644 --- a/src/NadekoBot/Modules/Searches/Common/Gallery.cs +++ b/src/NadekoBot/Modules/Searches/Common/Gallery.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public sealed class Tag { @@ -40,4 +41,4 @@ public sealed class Gallery UploadedAt = uploadedAt; Tags = tags; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/GatariUserResponse.cs b/src/NadekoBot/Modules/Searches/Common/GatariUserResponse.cs index 08c9a4195..60f987ddc 100644 --- a/src/NadekoBot/Modules/Searches/Common/GatariUserResponse.cs +++ b/src/NadekoBot/Modules/Searches/Common/GatariUserResponse.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -34,4 +35,4 @@ public class GatariUserResponse [JsonProperty("code")] public int Code { get; set; } [JsonProperty("users")] public List Users { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/GatariUserStatsResponse.cs b/src/NadekoBot/Modules/Searches/Common/GatariUserStatsResponse.cs index c3f46ac56..212c03568 100644 --- a/src/NadekoBot/Modules/Searches/Common/GatariUserStatsResponse.cs +++ b/src/NadekoBot/Modules/Searches/Common/GatariUserStatsResponse.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -50,4 +51,4 @@ public class GatariUserStatsResponse [JsonProperty("code")] public int Code { get; set; } [JsonProperty("stats")] public UserStats Stats { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/GoogleSearchResult.cs b/src/NadekoBot/Modules/Searches/Common/GoogleSearchResult.cs index 4cce6606e..d0f0e8810 100644 --- a/src/NadekoBot/Modules/Searches/Common/GoogleSearchResult.cs +++ b/src/NadekoBot/Modules/Searches/Common/GoogleSearchResult.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public sealed class GoogleSearchResult { @@ -12,4 +13,4 @@ public sealed class GoogleSearchResult this.Link = link; this.Text = text; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/HearthstoneCardData.cs b/src/NadekoBot/Modules/Searches/Common/HearthstoneCardData.cs index c14c46f9b..dc441e74c 100644 --- a/src/NadekoBot/Modules/Searches/Common/HearthstoneCardData.cs +++ b/src/NadekoBot/Modules/Searches/Common/HearthstoneCardData.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class HearthstoneCardData { @@ -9,4 +10,4 @@ public class HearthstoneCardData public string Img { get; set; } public string ImgGold { get; set; } public string PlayerClass { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/ImageCacherObject.cs b/src/NadekoBot/Modules/Searches/Common/ImageCacherObject.cs index 7d9893de3..85fae1a97 100644 --- a/src/NadekoBot/Modules/Searches/Common/ImageCacherObject.cs +++ b/src/NadekoBot/Modules/Searches/Common/ImageCacherObject.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Nsfw.Common; +#nullable disable +using NadekoBot.Modules.Nsfw.Common; namespace NadekoBot.Modules.Searches.Common; @@ -37,4 +38,4 @@ public class ImageCacherObject : IComparable public int CompareTo(ImageCacherObject other) => string.Compare(FileUrl, other.FileUrl, StringComparison.InvariantCulture); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/LowerCaseNamingPolicy.cs b/src/NadekoBot/Modules/Searches/Common/LowerCaseNamingPolicy.cs index 48f29e530..eda709db2 100644 --- a/src/NadekoBot/Modules/Searches/Common/LowerCaseNamingPolicy.cs +++ b/src/NadekoBot/Modules/Searches/Common/LowerCaseNamingPolicy.cs @@ -1,4 +1,5 @@ -using System.Text.Json; +#nullable disable +using System.Text.Json; namespace SystemTextJsonSamples; @@ -8,4 +9,4 @@ public class LowerCaseNamingPolicy : JsonNamingPolicy public override string ConvertName(string name) => name.ToLower(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/MagicItem.cs b/src/NadekoBot/Modules/Searches/Common/MagicItem.cs index 53b595807..48443f68f 100644 --- a/src/NadekoBot/Modules/Searches/Common/MagicItem.cs +++ b/src/NadekoBot/Modules/Searches/Common/MagicItem.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class MagicItem { public string Name { get; set; } public string Description { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/MangaResult.cs b/src/NadekoBot/Modules/Searches/Common/MangaResult.cs index 18512d8ee..952178e58 100644 --- a/src/NadekoBot/Modules/Searches/Common/MangaResult.cs +++ b/src/NadekoBot/Modules/Searches/Common/MangaResult.cs @@ -1,3 +1,4 @@ +#nullable disable using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -21,4 +22,4 @@ public class MangaResult public string AverageScore { get; set; } public string Link => "http://anilist.co/manga/" + Id; public string Synopsis => Description?[..(Description.Length > 500 ? 500 : Description.Length)] + "..."; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/MtgData.cs b/src/NadekoBot/Modules/Searches/Common/MtgData.cs index c1a5c6d39..f4ec55069 100644 --- a/src/NadekoBot/Modules/Searches/Common/MtgData.cs +++ b/src/NadekoBot/Modules/Searches/Common/MtgData.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class MtgData { @@ -22,4 +23,4 @@ public class MtgResponse } public List Cards { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/NhentaiApiModel.cs b/src/NadekoBot/Modules/Searches/Common/NhentaiApiModel.cs index b8b47cc49..961132387 100644 --- a/src/NadekoBot/Modules/Searches/Common/NhentaiApiModel.cs +++ b/src/NadekoBot/Modules/Searches/Common/NhentaiApiModel.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -87,4 +88,4 @@ public static class NhentaiApiModel { [JsonProperty("result")] public Gallery[] Result { get; set; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/NovelData.cs b/src/NadekoBot/Modules/Searches/Common/NovelData.cs index aea3a921b..a13a450e8 100644 --- a/src/NadekoBot/Modules/Searches/Common/NovelData.cs +++ b/src/NadekoBot/Modules/Searches/Common/NovelData.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class NovelResult { @@ -10,4 +11,4 @@ public class NovelResult public string Status { get; set; } public string[] Genres { get; set; } public string Score { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/OmdbMovie.cs b/src/NadekoBot/Modules/Searches/Common/OmdbMovie.cs index 06c219707..9a456b157 100644 --- a/src/NadekoBot/Modules/Searches/Common/OmdbMovie.cs +++ b/src/NadekoBot/Modules/Searches/Common/OmdbMovie.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class OmdbMovie { @@ -9,4 +10,4 @@ public class OmdbMovie public string Genre { get; set; } public string Plot { get; set; } public string Poster { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/OsuUserData.cs b/src/NadekoBot/Modules/Searches/Common/OsuUserData.cs index a8e4cd4a6..15c3ecf1d 100644 --- a/src/NadekoBot/Modules/Searches/Common/OsuUserData.cs +++ b/src/NadekoBot/Modules/Searches/Common/OsuUserData.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -45,4 +46,4 @@ public class OsuUserData [JsonProperty("total_seconds_played")] public string TotalSecondsPlayed { get; set; } [JsonProperty("pp_country_rank")] public string PpCountryRank { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/PathOfExileModels.cs b/src/NadekoBot/Modules/Searches/Common/PathOfExileModels.cs index f5d25979e..7f60f564b 100644 --- a/src/NadekoBot/Modules/Searches/Common/PathOfExileModels.cs +++ b/src/NadekoBot/Modules/Searches/Common/PathOfExileModels.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -36,4 +37,4 @@ public class Leagues [JsonProperty("endAt")] public object EndAt { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/SteamGameId.cs b/src/NadekoBot/Modules/Searches/Common/SteamGameId.cs index 6f95eb487..0119fdece 100644 --- a/src/NadekoBot/Modules/Searches/Common/SteamGameId.cs +++ b/src/NadekoBot/Modules/Searches/Common/SteamGameId.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches; @@ -31,4 +32,4 @@ public enum TimeErrors ApiKeyMissing, NotFound, Unknown -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/PicartoChannelResponse.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/PicartoChannelResponse.cs index cc7ba3161..6d5f6e357 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/PicartoChannelResponse.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/PicartoChannelResponse.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -107,4 +108,4 @@ public class Language [JsonProperty("id")] public int Id { get; set; } [JsonProperty("name")] public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamData.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamData.cs index 0077ccdfd..471ac1179 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamData.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamData.cs @@ -1,4 +1,5 @@ -using NadekoBot.Db.Models; +#nullable disable +using NadekoBot.Db.Models; namespace NadekoBot.Modules.Searches.Common; @@ -16,4 +17,4 @@ public class StreamData public string AvatarUrl { get; set; } public StreamDataKey CreateKey() => new(StreamType, UniqueName.ToLower()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamDataKey.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamDataKey.cs index 1cc3815dc..ae0fd23d1 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamDataKey.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/StreamDataKey.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +#nullable disable +using System.Text.Json.Serialization; using NadekoBot.Db.Models; namespace NadekoBot.Modules.Searches.Common; @@ -14,4 +15,4 @@ public readonly struct StreamDataKey Type = type; Name = name; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseHelix.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseHelix.cs index 55e645317..0a383eccd 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseHelix.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseHelix.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; // // public class TwitchResponse @@ -18,4 +19,4 @@ // public string ThumbnailUrl { get; set; } // public DateTime StartedAt { get; set; } // } -// } \ No newline at end of file +// } diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseV5.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseV5.cs index f0f3c08b7..eea5e048f 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseV5.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchResponseV5.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -79,4 +80,4 @@ public class TwitchResponseV5 [JsonProperty("viewers")] public int Viewers { get; set; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchUsersResponseV5.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchUsersResponseV5.cs index 20bb35fed..42591e479 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchUsersResponseV5.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Models/TwitchUsersResponseV5.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -34,4 +35,4 @@ public class TwitchUsersResponseV5 // public DateTime UpdatedAt { get; set; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/NotifChecker.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/NotifChecker.cs index 47d7481d1..945a4b805 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/NotifChecker.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/NotifChecker.cs @@ -3,7 +3,6 @@ using NadekoBot.Db.Models; using Newtonsoft.Json; using StackExchange.Redis; -#nullable enable namespace NadekoBot.Modules.Searches.Common.StreamNotifications; public class NotifChecker @@ -147,7 +146,7 @@ public class NotifChecker } catch (Exception ex) { - Log.Error(ex, $"Error getting stream notifications: {ex.Message}"); + Log.Error(ex, "Error getting stream notifications: {ErrorMessage}", ex.Message); } } }); @@ -237,4 +236,4 @@ public class NotifChecker public void UntrackStreamByKey(in StreamDataKey key) => CacheDeleteData(key); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/PicartoProvider.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/PicartoProvider.cs index f745e3f27..f4945bedb 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/PicartoProvider.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/PicartoProvider.cs @@ -2,7 +2,6 @@ using NadekoBot.Db.Models; using Newtonsoft.Json; -#nullable enable namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers; public class PicartoProvider : Provider @@ -71,7 +70,11 @@ public class PicartoProvider : Provider } catch (Exception ex) { - Log.Warning(ex, $"Something went wrong retreiving {Platform} stream data for {login}: {ex.Message}"); + Log.Warning("Something went wrong retreiving {StreamPlatform} stream data for {Login}: {ErrorMessage}", + Platform, + login, + ex.Message + ); _failingStreams.TryAdd(login, DateTime.UtcNow); } } @@ -93,4 +96,4 @@ public class PicartoProvider : Provider StreamUrl = $"https://picarto.tv/{stream.Name}", AvatarUrl = stream.Avatar }; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/Provider.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/Provider.cs index f083f10a0..c94fd47d5 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/Provider.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/Provider.cs @@ -1,6 +1,5 @@ using NadekoBot.Db.Models; -#nullable enable namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers; /// @@ -55,4 +54,4 @@ public abstract class Provider public void ClearErrorsFor(string login) => _failingStreams.TryRemove(login, out _); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchHelixProvider.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchHelixProvider.cs index 827b6dfb7..42194c753 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchHelixProvider.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchHelixProvider.cs @@ -1,4 +1,5 @@ -// using System; +#nullable disable +// using System; // using System.Collections.Generic; // using System.Linq; // using System.Net.Http; @@ -177,4 +178,4 @@ // public DateTime StartedAt { get; set; } // } // } -// } \ No newline at end of file +// } diff --git a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchProvider.cs b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchProvider.cs index ccca2319d..ef19756d2 100644 --- a/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchProvider.cs +++ b/src/NadekoBot/Modules/Searches/Common/StreamNotifications/Providers/TwitchProvider.cs @@ -2,7 +2,6 @@ using NadekoBot.Db.Models; using Newtonsoft.Json; -#nullable enable namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers; public class TwitchProvider : Provider @@ -100,7 +99,11 @@ public class TwitchProvider : Provider } catch (Exception ex) { - Log.Warning($"Something went wrong retreiving {Platform} stream data for {login}: {ex.Message}"); + Log.Warning("Something went wrong retreiving {StreamPlatform} stream data for {Login}: {ErrorMessage}", + Platform, + login, + ex.Message + ); _failingStreams.TryAdd(login, DateTime.UtcNow); } } @@ -122,4 +125,4 @@ public class TwitchProvider : Provider StreamUrl = $"https://twitch.tv/{stream.Channel.Name}", AvatarUrl = stream.Channel.Logo }; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/TimeData.cs b/src/NadekoBot/Modules/Searches/Common/TimeData.cs index 380802221..1c7f095be 100644 --- a/src/NadekoBot/Modules/Searches/Common/TimeData.cs +++ b/src/NadekoBot/Modules/Searches/Common/TimeData.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class TimeData { public string Address { get; set; } public DateTime Time { get; set; } public string TimeZoneName { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/TimeModels.cs b/src/NadekoBot/Modules/Searches/Common/TimeModels.cs index bbcbaa037..4fc9c6413 100644 --- a/src/NadekoBot/Modules/Searches/Common/TimeModels.cs +++ b/src/NadekoBot/Modules/Searches/Common/TimeModels.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -17,4 +18,4 @@ public class LocationIqResponse [JsonProperty("display_name")] public string DisplayName { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/UrbanDef.cs b/src/NadekoBot/Modules/Searches/Common/UrbanDef.cs index 026f6a009..b97e6016b 100644 --- a/src/NadekoBot/Modules/Searches/Common/UrbanDef.cs +++ b/src/NadekoBot/Modules/Searches/Common/UrbanDef.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class UrbanResponse { @@ -9,4 +10,4 @@ public class UrbanDef public string Word { get; set; } public string Definition { get; set; } public string Permalink { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/WeatherModels.cs b/src/NadekoBot/Modules/Searches/Common/WeatherModels.cs index 50cdf8776..2aa9eebe7 100644 --- a/src/NadekoBot/Modules/Searches/Common/WeatherModels.cs +++ b/src/NadekoBot/Modules/Searches/Common/WeatherModels.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; @@ -61,4 +62,4 @@ public class WeatherData public int Id { get; set; } public string Name { get; set; } public int Cod { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/WikipediaApiModel.cs b/src/NadekoBot/Modules/Searches/Common/WikipediaApiModel.cs index 7142b6092..94f016f02 100644 --- a/src/NadekoBot/Modules/Searches/Common/WikipediaApiModel.cs +++ b/src/NadekoBot/Modules/Searches/Common/WikipediaApiModel.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class WikipediaApiModel { @@ -14,4 +15,4 @@ public class WikipediaApiModel public string FullUrl { get; set; } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Common/WoWJoke.cs b/src/NadekoBot/Modules/Searches/Common/WoWJoke.cs index e3aeb1fc1..45f42664c 100644 --- a/src/NadekoBot/Modules/Searches/Common/WoWJoke.cs +++ b/src/NadekoBot/Modules/Searches/Common/WoWJoke.cs @@ -1,8 +1,9 @@ -namespace NadekoBot.Modules.Searches.Common; +#nullable disable +namespace NadekoBot.Modules.Searches.Common; public class WoWJoke { public string Question { get; set; } public string Answer { get; set; } public override string ToString() => $"`{Question}`\n\n**{Answer}**"; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/CryptoCommands.cs b/src/NadekoBot/Modules/Searches/CryptoCommands.cs index b55c9e430..63fe156e8 100644 --- a/src/NadekoBot/Modules/Searches/CryptoCommands.cs +++ b/src/NadekoBot/Modules/Searches/CryptoCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Services; +#nullable disable +using NadekoBot.Modules.Searches.Services; namespace NadekoBot.Modules.Searches; @@ -54,4 +55,4 @@ public partial class Searches .WithImageUrl($"https://s3.coinmarketcap.com/generated/sparklines/web/7d/usd/{crypto.Id}.png")).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/FeedCommands.cs b/src/NadekoBot/Modules/Searches/FeedCommands.cs index c96bf8f9a..ede9274ee 100644 --- a/src/NadekoBot/Modules/Searches/FeedCommands.cs +++ b/src/NadekoBot/Modules/Searches/FeedCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Services; +#nullable disable +using NadekoBot.Modules.Searches.Services; using System.Text.RegularExpressions; namespace NadekoBot.Modules.Searches; @@ -36,7 +37,7 @@ public partial class Searches (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps); if (success) { - channel = channel ?? (ITextChannel)ctx.Channel; + channel ??= (ITextChannel)ctx.Channel; try { var feeds = await CodeHollow.FeedReader.FeedReader.ReadAsync(url).ConfigureAwait(false); @@ -104,4 +105,4 @@ public partial class Searches }, feeds.Count, 10).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/JokeCommands.cs b/src/NadekoBot/Modules/Searches/JokeCommands.cs index dd0f037ab..224975434 100644 --- a/src/NadekoBot/Modules/Searches/JokeCommands.cs +++ b/src/NadekoBot/Modules/Searches/JokeCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Services; +#nullable disable +using NadekoBot.Modules.Searches.Services; namespace NadekoBot.Modules.Searches; @@ -48,4 +49,4 @@ public partial class Searches await SendConfirmAsync("✨" + item.Name, item.Description).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/MemegenCommands.cs b/src/NadekoBot/Modules/Searches/MemegenCommands.cs index b42d66288..64ae7a9cc 100644 --- a/src/NadekoBot/Modules/Searches/MemegenCommands.cs +++ b/src/NadekoBot/Modules/Searches/MemegenCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using System.Collections.Immutable; using System.Text; using Newtonsoft.Json; @@ -93,4 +94,4 @@ public partial class Searches return sb.ToString(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/OsuCommands.cs b/src/NadekoBot/Modules/Searches/OsuCommands.cs index 18134133d..2d369c80a 100644 --- a/src/NadekoBot/Modules/Searches/OsuCommands.cs +++ b/src/NadekoBot/Modules/Searches/OsuCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Common; +#nullable disable +using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json; namespace NadekoBot.Modules.Searches; @@ -305,4 +306,4 @@ public partial class Searches private static bool IsBitSet(int mods, int pos) => (mods & (1 << pos)) != 0; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs b/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs index caa56b511..511f5fb15 100644 --- a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs +++ b/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Common; +#nullable disable +using NadekoBot.Modules.Searches.Common; using NadekoBot.Modules.Searches.Services; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -306,4 +307,4 @@ public partial class Searches return league; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/PlaceCommands.cs b/src/NadekoBot/Modules/Searches/PlaceCommands.cs index 45fb34e04..6e416b8ee 100644 --- a/src/NadekoBot/Modules/Searches/PlaceCommands.cs +++ b/src/NadekoBot/Modules/Searches/PlaceCommands.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches; +#nullable disable +namespace NadekoBot.Modules.Searches; public partial class Searches { @@ -69,4 +70,4 @@ public partial class Searches await ctx.Channel.SendMessageAsync(url).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs index 99ea5188c..d76d057a5 100644 --- a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Services; +#nullable disable +using NadekoBot.Modules.Searches.Services; using NadekoBot.Common.Pokemon; namespace NadekoBot.Modules.Searches; @@ -63,4 +64,4 @@ public partial class Searches await ReplyErrorLocalizedAsync(strs.pokemon_ability_none).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index 7f547e4ee..be9895dfc 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -1,4 +1,5 @@ -using AngleSharp; +#nullable disable +using AngleSharp; using AngleSharp.Html.Dom; using Microsoft.Extensions.Caching.Memory; using NadekoBot.Modules.Searches.Common; @@ -733,4 +734,4 @@ public partial class Searches : NadekoModule await ErrorLocalizedAsync(strs.specify_search_params).ConfigureAwait(false); return false; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs b/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs index 631fcd7d8..259129eb7 100644 --- a/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs +++ b/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs @@ -1,4 +1,5 @@ -using AngleSharp; +#nullable disable +using AngleSharp; using AngleSharp.Html.Dom; using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json; @@ -149,4 +150,4 @@ public class AnimeSearchService : INService return null; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/AtlExtensions.cs b/src/NadekoBot/Modules/Searches/Services/AtlExtensions.cs index 458bbd73f..2bf363171 100644 --- a/src/NadekoBot/Modules/Searches/Services/AtlExtensions.cs +++ b/src/NadekoBot/Modules/Searches/Services/AtlExtensions.cs @@ -1,4 +1,5 @@ -using LinqToDB.EntityFrameworkCore; +#nullable disable +using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; @@ -10,4 +11,4 @@ public static class AtlExtensions => set .Include(x => x.Users) .FirstOrDefaultAsyncEF(x => x.ChannelId == channelId); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/CryptoService.cs b/src/NadekoBot/Modules/Searches/Services/CryptoService.cs index 202984d36..2f068ca85 100644 --- a/src/NadekoBot/Modules/Searches/Services/CryptoService.cs +++ b/src/NadekoBot/Modules/Searches/Services/CryptoService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Common; +#nullable disable +using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Services; @@ -95,4 +96,4 @@ public class CryptoService : INService getCryptoLock.Release(); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/FeedsService.cs b/src/NadekoBot/Modules/Searches/Services/FeedsService.cs index 6fce998bb..705bc7b96 100644 --- a/src/NadekoBot/Modules/Searches/Services/FeedsService.cs +++ b/src/NadekoBot/Modules/Searches/Services/FeedsService.cs @@ -1,4 +1,5 @@ -using CodeHollow.FeedReader.Feeds; +#nullable disable +using CodeHollow.FeedReader.Feeds; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -228,4 +229,4 @@ public class FeedsService : INService return true; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/ITranslateService.cs b/src/NadekoBot/Modules/Searches/Services/ITranslateService.cs index acb9b974b..312ac70de 100644 --- a/src/NadekoBot/Modules/Searches/Services/ITranslateService.cs +++ b/src/NadekoBot/Modules/Searches/Services/ITranslateService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches; +#nullable disable +namespace NadekoBot.Modules.Searches; public interface ITranslateService { @@ -7,4 +8,4 @@ public interface ITranslateService IEnumerable GetLanguages(); Task RegisterUserAsync(ulong userId, ulong channelId, string @from, string to); Task UnregisterUser(ulong channelId, ulong userId); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/SearchesService.cs b/src/NadekoBot/Modules/Searches/Services/SearchesService.cs index 935d1602a..a295f422a 100644 --- a/src/NadekoBot/Modules/Searches/Services/SearchesService.cs +++ b/src/NadekoBot/Modules/Searches/Services/SearchesService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Searches.Common; +#nullable disable +using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SixLabors.ImageSharp; @@ -650,4 +651,4 @@ public class SearchesService : INService fullQueryLink, "0"); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs b/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs index bb50fa087..857f71a1f 100644 --- a/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs +++ b/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs @@ -1,3 +1,4 @@ +#nullable disable using Microsoft.EntityFrameworkCore; using NadekoBot.Modules.Searches.Common; using NadekoBot.Modules.Searches.Common.StreamNotifications; @@ -555,4 +556,4 @@ public sealed class StreamNotificationService : INService public StreamDataKey Key { get; init; } public ulong GuildId { get; init; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/TranslateService.cs b/src/NadekoBot/Modules/Searches/Services/TranslateService.cs index 248630ecb..a869a5be6 100644 --- a/src/NadekoBot/Modules/Searches/Services/TranslateService.cs +++ b/src/NadekoBot/Modules/Searches/Services/TranslateService.cs @@ -1,4 +1,5 @@ -using System.Net; +#nullable disable +using System.Net; using LinqToDB; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -222,4 +223,4 @@ public sealed class TranslateService : ITranslateService, ILateExecutor, IReadyE } public IEnumerable GetLanguages() => _google.Languages.Select(x => x.Key); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/Services/YtTrackService.cs b/src/NadekoBot/Modules/Searches/Services/YtTrackService.cs index fe43d6ff0..cc0a2d4c5 100644 --- a/src/NadekoBot/Modules/Searches/Services/YtTrackService.cs +++ b/src/NadekoBot/Modules/Searches/Services/YtTrackService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches.Services; +#nullable disable +namespace NadekoBot.Modules.Searches.Services; // public class YtTrackService : INService // { @@ -131,4 +132,4 @@ // // return true; // } -// } \ No newline at end of file +// } diff --git a/src/NadekoBot/Modules/Searches/StreamNotificationCommands.cs b/src/NadekoBot/Modules/Searches/StreamNotificationCommands.cs index ad0142e1e..194a03f5f 100644 --- a/src/NadekoBot/Modules/Searches/StreamNotificationCommands.cs +++ b/src/NadekoBot/Modules/Searches/StreamNotificationCommands.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Modules.Searches.Services; using NadekoBot.Db; using NadekoBot.Db.Models; @@ -211,4 +212,4 @@ public partial class Searches } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/TranslatorCommands.cs b/src/NadekoBot/Modules/Searches/TranslatorCommands.cs index 8d1a71dee..835977652 100644 --- a/src/NadekoBot/Modules/Searches/TranslatorCommands.cs +++ b/src/NadekoBot/Modules/Searches/TranslatorCommands.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches; +#nullable disable +namespace NadekoBot.Modules.Searches; public partial class Searches { @@ -89,4 +90,4 @@ public partial class Searches public async Task Translangs() => await ctx.Channel.SendTableAsync(_service.GetLanguages(), str => $"{str,-15}", 3).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/XkcdCommands.cs b/src/NadekoBot/Modules/Searches/XkcdCommands.cs index 9d35a721e..733c84236 100644 --- a/src/NadekoBot/Modules/Searches/XkcdCommands.cs +++ b/src/NadekoBot/Modules/Searches/XkcdCommands.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Modules.Searches; @@ -89,4 +90,4 @@ public partial class Searches public string ImageLink { get; set; } public string Alt { get; set; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Searches/YtUploadCommands.cs b/src/NadekoBot/Modules/Searches/YtUploadCommands.cs index 22794d601..894fa4da4 100644 --- a/src/NadekoBot/Modules/Searches/YtUploadCommands.cs +++ b/src/NadekoBot/Modules/Searches/YtUploadCommands.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Searches; +#nullable disable +namespace NadekoBot.Modules.Searches; public partial class Searches { @@ -50,4 +51,4 @@ public partial class Searches // //} // } // } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/CalcCommands.cs b/src/NadekoBot/Modules/Utility/CalcCommands.cs index 645027402..bdb575a4a 100644 --- a/src/NadekoBot/Modules/Utility/CalcCommands.cs +++ b/src/NadekoBot/Modules/Utility/CalcCommands.cs @@ -1,4 +1,5 @@ -using System.Reflection; +#nullable disable +using System.Reflection; namespace NadekoBot.Modules.Utility; @@ -51,4 +52,4 @@ public partial class Utility await SendConfirmAsync(GetText(strs.calcops(Prefix)), string.Join(", ", selection)); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/CommandMapCommands.cs b/src/NadekoBot/Modules/Utility/CommandMapCommands.cs index fa65a2c3b..a6e3c2ece 100644 --- a/src/NadekoBot/Modules/Utility/CommandMapCommands.cs +++ b/src/NadekoBot/Modules/Utility/CommandMapCommands.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +#nullable disable +using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; using NadekoBot.Modules.Utility.Services; @@ -133,4 +134,4 @@ public partial class Utility }, arr.Length, 10).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Common/ConvertUnit.cs b/src/NadekoBot/Modules/Utility/Common/ConvertUnit.cs index 0c7d4369d..f77678c76 100644 --- a/src/NadekoBot/Modules/Utility/Common/ConvertUnit.cs +++ b/src/NadekoBot/Modules/Utility/Common/ConvertUnit.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +#nullable disable +using System.Diagnostics; namespace NadekoBot.Modules.Utility.Common; @@ -8,4 +9,4 @@ public class ConvertUnit public string[] Triggers { get; set; } public string UnitType { get; set; } public decimal Modifier { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRoleNotFoundException.cs b/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRoleNotFoundException.cs index af43a7676..b924e0489 100644 --- a/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRoleNotFoundException.cs +++ b/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRoleNotFoundException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Utility.Common.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Utility.Common.Exceptions; public class StreamRoleNotFoundException : Exception { @@ -13,4 +14,4 @@ public class StreamRoleNotFoundException : Exception public StreamRoleNotFoundException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRolePermissionException.cs b/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRolePermissionException.cs index c0bc5b3a8..d6197a1f5 100644 --- a/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRolePermissionException.cs +++ b/src/NadekoBot/Modules/Utility/Common/Exceptions/StreamRolePermissionException.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Utility.Common.Exceptions; +#nullable disable +namespace NadekoBot.Modules.Utility.Common.Exceptions; public class StreamRolePermissionException : Exception { @@ -13,4 +14,4 @@ public class StreamRolePermissionException : Exception public StreamRolePermissionException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Common/Patreon/PatreonData.cs b/src/NadekoBot/Modules/Utility/Common/Patreon/PatreonData.cs index 707733c72..5080853f7 100644 --- a/src/NadekoBot/Modules/Utility/Common/Patreon/PatreonData.cs +++ b/src/NadekoBot/Modules/Utility/Common/Patreon/PatreonData.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +#nullable disable +using System.Text.Json.Serialization; namespace NadekoBot.Modules.Utility.Common.Patreon; @@ -128,4 +129,4 @@ public sealed class PatreonUserData { [JsonPropertyName("id")] public string Id { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Common/StreamRoleListType.cs b/src/NadekoBot/Modules/Utility/Common/StreamRoleListType.cs index 0c70adeba..67112c7a0 100644 --- a/src/NadekoBot/Modules/Utility/Common/StreamRoleListType.cs +++ b/src/NadekoBot/Modules/Utility/Common/StreamRoleListType.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Modules.Utility.Common; +#nullable disable +namespace NadekoBot.Modules.Utility.Common; public enum StreamRoleListType { Whitelist, Blacklist, -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/ConfigCommands.cs b/src/NadekoBot/Modules/Utility/ConfigCommands.cs index cd0cdcf9b..03b0b3944 100644 --- a/src/NadekoBot/Modules/Utility/ConfigCommands.cs +++ b/src/NadekoBot/Modules/Utility/ConfigCommands.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Utility; +#nullable disable +namespace NadekoBot.Modules.Utility; public partial class Utility { @@ -154,4 +155,4 @@ public partial class Utility return Format.Code(string.Concat(strings), "hs"); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/InfoCommands.cs b/src/NadekoBot/Modules/Utility/InfoCommands.cs index 4bc6aedb2..f6c4a4de7 100644 --- a/src/NadekoBot/Modules/Utility/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/InfoCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using System.Text; namespace NadekoBot.Modules.Utility; @@ -144,4 +145,4 @@ public partial class Utility .WithDescription(str.ToString())).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/InviteCommands.cs b/src/NadekoBot/Modules/Utility/InviteCommands.cs index 95bdb2206..eb26df3f6 100644 --- a/src/NadekoBot/Modules/Utility/InviteCommands.cs +++ b/src/NadekoBot/Modules/Utility/InviteCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Utility.Services; +#nullable disable +using NadekoBot.Modules.Utility.Services; namespace NadekoBot.Modules.Utility; @@ -94,4 +95,4 @@ public partial class Utility await ReplyAsync(GetText(strs.invite_deleted(Format.Bold(inv.Code)))); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/QuoteCommands.cs b/src/NadekoBot/Modules/Utility/QuoteCommands.cs index fe481e93b..06f36bd48 100644 --- a/src/NadekoBot/Modules/Utility/QuoteCommands.cs +++ b/src/NadekoBot/Modules/Utility/QuoteCommands.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Common.Yml; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -374,4 +375,4 @@ public partial class Utility return true; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/RemindCommands.cs b/src/NadekoBot/Modules/Utility/RemindCommands.cs index 86ce25dd9..6a53c0ad0 100644 --- a/src/NadekoBot/Modules/Utility/RemindCommands.cs +++ b/src/NadekoBot/Modules/Utility/RemindCommands.cs @@ -1,4 +1,5 @@ -using Humanizer.Localisation; +#nullable disable +using Humanizer.Localisation; using NadekoBot.Services.Database.Models; using NadekoBot.Db; using NadekoBot.Modules.Administration.Services; @@ -240,4 +241,4 @@ public partial class Utility return true; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/RepeatCommands.cs b/src/NadekoBot/Modules/Utility/RepeatCommands.cs index 461d6ef88..413e0cc44 100644 --- a/src/NadekoBot/Modules/Utility/RepeatCommands.cs +++ b/src/NadekoBot/Modules/Utility/RepeatCommands.cs @@ -1,5 +1,4 @@ -#nullable enable -using NadekoBot.Common.TypeReaders; +using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Utility.Services; using NadekoBot.Common.TypeReaders.Models; @@ -196,4 +195,4 @@ public partial class Utility return description; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/CommandMapService.cs b/src/NadekoBot/Modules/Utility/Services/CommandMapService.cs index bde154f89..7871617c0 100644 --- a/src/NadekoBot/Modules/Utility/Services/CommandMapService.cs +++ b/src/NadekoBot/Modules/Utility/Services/CommandMapService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database.Models; using NadekoBot.Db; @@ -92,4 +93,4 @@ public class CommandMapService : IInputTransformer, INService return input; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/ConverterService.cs b/src/NadekoBot/Modules/Utility/Services/ConverterService.cs index 39d503252..7e278cdb2 100644 --- a/src/NadekoBot/Modules/Utility/Services/ConverterService.cs +++ b/src/NadekoBot/Modules/Utility/Services/ConverterService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Utility.Common; +#nullable disable +using NadekoBot.Modules.Utility.Common; using Newtonsoft.Json; namespace NadekoBot.Modules.Utility.Services; @@ -83,4 +84,4 @@ public class Rates public DateTime Date { get; set; } [JsonProperty("rates")] public Dictionary ConversionRates { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/InviteService.cs b/src/NadekoBot/Modules/Utility/Services/InviteService.cs index f846e5664..b89bf43f4 100644 --- a/src/NadekoBot/Modules/Utility/Services/InviteService.cs +++ b/src/NadekoBot/Modules/Utility/Services/InviteService.cs @@ -1,4 +1,5 @@ -using CommandLine; +#nullable disable +using CommandLine; namespace NadekoBot.Modules.Utility.Services; @@ -27,4 +28,4 @@ public class InviteService : INService Expire = 0; } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/PatreonRewardsService.cs b/src/NadekoBot/Modules/Utility/Services/PatreonRewardsService.cs index db6c59149..6865dc292 100644 --- a/src/NadekoBot/Modules/Utility/Services/PatreonRewardsService.cs +++ b/src/NadekoBot/Modules/Utility/Services/PatreonRewardsService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Utility.Common.Patreon; using System.Net.Http.Json; using System.Text.Json.Serialization; @@ -302,4 +303,4 @@ public class PatreonRewardsService : INService // ignored } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/RemindService.cs b/src/NadekoBot/Modules/Utility/Services/RemindService.cs index 7dcfb9bd4..9df018bd6 100644 --- a/src/NadekoBot/Modules/Utility/Services/RemindService.cs +++ b/src/NadekoBot/Modules/Utility/Services/RemindService.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +#nullable disable +using System.Text.RegularExpressions; using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; @@ -165,4 +166,4 @@ public class RemindService : INService } catch (Exception ex) { Log.Information(ex.Message + $"({r.Id})"); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/RepeaterService.cs b/src/NadekoBot/Modules/Utility/Services/RepeaterService.cs index 6aa187c65..3b0fa06ca 100644 --- a/src/NadekoBot/Modules/Utility/Services/RepeaterService.cs +++ b/src/NadekoBot/Modules/Utility/Services/RepeaterService.cs @@ -1,4 +1,4 @@ -#nullable enable + using Microsoft.EntityFrameworkCore; using LinqToDB; using LinqToDB.EntityFrameworkCore; @@ -418,4 +418,4 @@ where ((guildid >> 22) % {_creds.TotalShards}) == {_client.ShardId};") public bool IsNoRedundant(int repeaterId) => _noRedundant.Contains(repeaterId); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/RunningRepeater.cs b/src/NadekoBot/Modules/Utility/Services/RunningRepeater.cs index 3a67c4594..8caa18522 100644 --- a/src/NadekoBot/Modules/Utility/Services/RunningRepeater.cs +++ b/src/NadekoBot/Modules/Utility/Services/RunningRepeater.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Utility.Services; @@ -95,4 +96,4 @@ public sealed class RunningRepeater public override int GetHashCode() => this.Repeater.Id; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/StreamRoleService.cs b/src/NadekoBot/Modules/Utility/Services/StreamRoleService.cs index 49b401474..dadbeb36e 100644 --- a/src/NadekoBot/Modules/Utility/Services/StreamRoleService.cs +++ b/src/NadekoBot/Modules/Utility/Services/StreamRoleService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Utility.Common; using NadekoBot.Modules.Utility.Common.Exceptions; @@ -266,7 +267,7 @@ public class StreamRoleService : INService { try { - addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId); + addRole ??= user.Guild.GetRole(setting.AddRoleId); if (addRole is null) throw new StreamRoleNotFoundException(); @@ -305,4 +306,4 @@ public class StreamRoleService : INService private void UpdateCache(ulong guildId, StreamRoleSettings setting) => guildSettings.AddOrUpdate(guildId, key => setting, (key, old) => setting); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Services/VerboseErrorsService.cs b/src/NadekoBot/Modules/Utility/Services/VerboseErrorsService.cs index 7d99fe082..e71858396 100644 --- a/src/NadekoBot/Modules/Utility/Services/VerboseErrorsService.cs +++ b/src/NadekoBot/Modules/Utility/Services/VerboseErrorsService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Help.Services; +#nullable disable +using NadekoBot.Modules.Help.Services; using NadekoBot.Db; namespace NadekoBot.Modules.Utility.Services; @@ -63,4 +64,4 @@ public class VerboseErrorsService : INService return (bool)enabled; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/StreamRoleCommands.cs b/src/NadekoBot/Modules/Utility/StreamRoleCommands.cs index 254102fd2..68c01761b 100644 --- a/src/NadekoBot/Modules/Utility/StreamRoleCommands.cs +++ b/src/NadekoBot/Modules/Utility/StreamRoleCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Utility.Services; +#nullable disable +using NadekoBot.Modules.Utility.Services; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Utility.Common; @@ -85,4 +86,4 @@ public partial class Utility await ReplyErrorLocalizedAsync(strs.stream_role_wl_rem_fail(Format.Bold(user.ToString()))).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs b/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs index 86faccf1b..d7ddb956c 100644 --- a/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs +++ b/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Utility.Services; +#nullable disable +using NadekoBot.Modules.Utility.Services; namespace NadekoBot.Modules.Utility; @@ -63,7 +64,7 @@ public partial class Utility switch (targetUnit.Triggers.First().ToUpperInvariant()) { case "C": - res = res - 273.15m; //celcius! + res -= 273.15m; //celcius! break; case "F": res = (res * (9m / 5m)) - 459.67m; @@ -84,4 +85,4 @@ public partial class Utility await SendConfirmAsync(GetText(strs.convert(value, originUnit.Triggers.Last(), res, targetUnit.Triggers.Last()))); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 642712323..bafec4c7d 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -1,3 +1,4 @@ +#nullable disable using Newtonsoft.Json; using System.Diagnostics; using System.Text; @@ -498,4 +499,4 @@ public partial class Utility : NadekoModule // return embed; // }, inviteUsers.Count, 9); // } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Utility/VerboseErrorCommands.cs b/src/NadekoBot/Modules/Utility/VerboseErrorCommands.cs index 25665cb21..00557b418 100644 --- a/src/NadekoBot/Modules/Utility/VerboseErrorCommands.cs +++ b/src/NadekoBot/Modules/Utility/VerboseErrorCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Utility.Services; +#nullable disable +using NadekoBot.Modules.Utility.Services; namespace NadekoBot.Modules.Utility; @@ -20,4 +21,4 @@ public partial class Utility await ReplyConfirmLocalizedAsync(strs.verbose_errors_disabled).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Club.cs b/src/NadekoBot/Modules/Xp/Club.cs index 230219600..53e223daa 100644 --- a/src/NadekoBot/Modules/Xp/Club.cs +++ b/src/NadekoBot/Modules/Xp/Club.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Xp.Services; +#nullable disable +using NadekoBot.Modules.Xp.Services; namespace NadekoBot.Modules.Xp; @@ -80,7 +81,7 @@ public partial class Xp [Priority(1)] public async Task ClubInformation(IUser user = null) { - user = user ?? ctx.User; + user ??= ctx.User; var club = _service.GetClubByMember(user); if (club is null) { @@ -368,4 +369,4 @@ public partial class Xp return ctx.Channel.EmbedAsync(embed); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Common/FullUserStats.cs b/src/NadekoBot/Modules/Xp/Common/FullUserStats.cs index 4845d1e9b..0c12bd9be 100644 --- a/src/NadekoBot/Modules/Xp/Common/FullUserStats.cs +++ b/src/NadekoBot/Modules/Xp/Common/FullUserStats.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Db.Models; namespace NadekoBot.Modules.Xp; @@ -22,4 +23,4 @@ public class FullUserStats GuildRanking = guildRanking; FullGuildStats = fullGuildStats; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Common/LevelStats.cs b/src/NadekoBot/Modules/Xp/Common/LevelStats.cs index e747d54e0..ade55844a 100644 --- a/src/NadekoBot/Modules/Xp/Common/LevelStats.cs +++ b/src/NadekoBot/Modules/Xp/Common/LevelStats.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Xp.Services; +#nullable disable +using NadekoBot.Modules.Xp.Services; namespace NadekoBot.Modules.Xp; @@ -36,4 +37,4 @@ public class LevelStats LevelXp = xp - totalXp; RequiredXp = required; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Common/XpConfig.cs b/src/NadekoBot/Modules/Xp/Common/XpConfig.cs index 2effb74a1..ae41c37d6 100644 --- a/src/NadekoBot/Modules/Xp/Common/XpConfig.cs +++ b/src/NadekoBot/Modules/Xp/Common/XpConfig.cs @@ -1,4 +1,5 @@ -using Cloneable; +#nullable disable +using Cloneable; using NadekoBot.Common.Yml; namespace NadekoBot.Modules.Xp; @@ -23,4 +24,4 @@ public sealed partial class XpConfig : ICloneable [Comment(@"The maximum amount of minutes the bot will keep track of a user in a voice channel")] public int VoiceMaxMinutes { get; set; } = 720; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Common/XpTemplate.cs b/src/NadekoBot/Modules/Xp/Common/XpTemplate.cs index ed8bc41c3..8c2847498 100644 --- a/src/NadekoBot/Modules/Xp/Common/XpTemplate.cs +++ b/src/NadekoBot/Modules/Xp/Common/XpTemplate.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; using SixLabors.ImageSharp.PixelFormats; namespace NadekoBot.Modules.Xp; @@ -287,4 +288,4 @@ public class XpRgba32Converter : JsonConverter public override void WriteJson(JsonWriter writer, Rgba32 value, JsonSerializer serializer) => writer.WriteValue(value.ToHex().ToLowerInvariant()); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Extensions/Extensions.cs b/src/NadekoBot/Modules/Xp/Extensions/Extensions.cs index 5dd9ce587..324d9af32 100644 --- a/src/NadekoBot/Modules/Xp/Extensions/Extensions.cs +++ b/src/NadekoBot/Modules/Xp/Extensions/Extensions.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Xp.Services; +#nullable disable +using NadekoBot.Modules.Xp.Services; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Xp.Extensions; @@ -25,4 +26,4 @@ public static class Extensions return (lvl - 1, stats.Xp - totalXp, required); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/ResetCommands.cs b/src/NadekoBot/Modules/Xp/ResetCommands.cs index 223576fb7..13f52a07c 100644 --- a/src/NadekoBot/Modules/Xp/ResetCommands.cs +++ b/src/NadekoBot/Modules/Xp/ResetCommands.cs @@ -1,4 +1,5 @@ -using NadekoBot.Modules.Xp.Services; +#nullable disable +using NadekoBot.Modules.Xp.Services; namespace NadekoBot.Modules.Xp; @@ -47,4 +48,4 @@ public partial class Xp await ReplyConfirmLocalizedAsync(strs.reset_server).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Services/ClubService.cs b/src/NadekoBot/Modules/Xp/Services/ClubService.cs index 40d99f1dc..a294d42da 100644 --- a/src/NadekoBot/Modules/Xp/Services/ClubService.cs +++ b/src/NadekoBot/Modules/Xp/Services/ClubService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Db.Models; +#nullable disable +using NadekoBot.Db.Models; using NadekoBot.Db; namespace NadekoBot.Modules.Xp.Services; @@ -331,4 +332,4 @@ public class ClubService : INService using var uow = _db.GetDbContext(); return uow.Clubs.GetClubLeaderboardPage(page); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Services/UserCacheItem.cs b/src/NadekoBot/Modules/Xp/Services/UserCacheItem.cs index ae995a69d..b314a8571 100644 --- a/src/NadekoBot/Modules/Xp/Services/UserCacheItem.cs +++ b/src/NadekoBot/Modules/Xp/Services/UserCacheItem.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Modules.Xp.Services; +#nullable disable +namespace NadekoBot.Modules.Xp.Services; public class UserCacheItem { @@ -12,4 +13,4 @@ public class UserCacheItem public override bool Equals(object obj) => obj is UserCacheItem uci && uci.User == User; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Services/XpConfigService.cs b/src/NadekoBot/Modules/Xp/Services/XpConfigService.cs index a2d7e37ca..3e824dbb5 100644 --- a/src/NadekoBot/Modules/Xp/Services/XpConfigService.cs +++ b/src/NadekoBot/Modules/Xp/Services/XpConfigService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Configs; +#nullable disable +using NadekoBot.Common.Configs; namespace NadekoBot.Modules.Xp.Services; @@ -37,4 +38,4 @@ public sealed class XpConfigService : ConfigServiceBase }); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Services/XpService.cs b/src/NadekoBot/Modules/Xp/Services/XpService.cs index f007231ad..f67d5aa84 100644 --- a/src/NadekoBot/Modules/Xp/Services/XpService.cs +++ b/src/NadekoBot/Modules/Xp/Services/XpService.cs @@ -1,3 +1,4 @@ +#nullable disable using NadekoBot.Db.Models; using Newtonsoft.Json; using SixLabors.Fonts; @@ -1158,4 +1159,4 @@ public class XpService : INService uow.RemoveRange(guildConfig.XpSettings.CurrencyRewards); await uow.SaveChangesAsync(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/NadekoBot/Modules/Xp/Xp.cs index 4e520ee88..49c05f63e 100644 --- a/src/NadekoBot/Modules/Xp/Xp.cs +++ b/src/NadekoBot/Modules/Xp/Xp.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +#nullable disable +using NadekoBot.Services.Database.Models; using NadekoBot.Modules.Xp.Services; using NadekoBot.Modules.Gambling.Services; @@ -19,7 +20,7 @@ public partial class Xp : NadekoModule [RequireContext(ContextType.Guild)] public async Task Experience([Leftover] IUser user = null) { - user = user ?? ctx.User; + user ??= ctx.User; await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false); var (img, fmt) = await _service.GenerateXpImageAsync((IGuildUser)user).ConfigureAwait(false); await using (img) @@ -434,4 +435,4 @@ public partial class Xp : NadekoModule await Task.Delay(1000).ConfigureAwait(false); await ReplyConfirmLocalizedAsync(strs.template_reloaded).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Program.cs b/src/NadekoBot/Program.cs index 53bb67dbc..2f9f4fd43 100644 --- a/src/NadekoBot/Program.cs +++ b/src/NadekoBot/Program.cs @@ -1,4 +1,4 @@ -var pid = Environment.ProcessId; +var pid = Environment.ProcessId; var shardId = 0; int? totalShards = null; // 0 to read from creds.yml @@ -25,4 +25,4 @@ int? totalShards = null; // 0 to read from creds.yml LogSetup.SetupLogger(shardId); Log.Information("Pid: {ProcessId}", pid); -await new Bot(shardId, totalShards).RunAndBlockAsync(); \ No newline at end of file +await new Bot(shardId, totalShards).RunAndBlockAsync(); diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/NadekoBot/Services/CommandHandler.cs index 912937e27..d806b0930 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/NadekoBot/Services/CommandHandler.cs @@ -1,4 +1,5 @@ -using System.Collections.Immutable; +#nullable disable +using System.Collections.Immutable; using NadekoBot.Common.Configs; using NadekoBot.Db; using Discord.Interactions; @@ -194,34 +195,42 @@ public class CommandHandler : INService } } - private async Task MessageReceivedHandler(SocketMessage msg) + private Task MessageReceivedHandler(SocketMessage msg) { - - try - { - if (msg.Author.IsBot || !_bot.IsReady) //no bots, wait until bot connected and initialized - return; + //no bots, wait until bot connected and initialized + if (msg.Author.IsBot || !_bot.IsReady) + return Task.CompletedTask; - if (msg is not SocketUserMessage usrMsg) - return; + if (msg is not SocketUserMessage usrMsg) + return Task.CompletedTask; + + Task.Run(async () => + { + try + { #if !GLOBAL_NADEKO - // track how many messagges each user is sending - UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (key, old) => ++old); + // track how many messagges each user is sending + UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (key, old) => ++old); #endif - var channel = msg.Channel; - var guild = (msg.Channel as SocketTextChannel)?.Guild; + var channel = msg.Channel; + var guild = (msg.Channel as SocketTextChannel)?.Guild; - await TryRunCommand(guild, channel, usrMsg).ConfigureAwait(false); - } - catch (Exception ex) - { - Log.Warning(ex, "Error in CommandHandler"); - if (ex.InnerException != null) - { - Log.Warning(ex.InnerException, "Inner Exception of the error in CommandHandler"); + await TryRunCommand(guild, channel, usrMsg) + .ConfigureAwait(false); + } + catch (Exception ex) + { + Log.Warning(ex, "Error in CommandHandler"); + if (ex.InnerException != null) + { + Log.Warning(ex.InnerException, "Inner Exception of the error in CommandHandler"); + } + } } - } + ); + + return Task.CompletedTask; } public async Task TryRunCommand(SocketGuild guild, ISocketMessageChannel channel, IUserMessage usrMsg) @@ -374,4 +383,4 @@ public class CommandHandler : INService return (true, null, cmd); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/DbService.cs b/src/NadekoBot/Services/DbService.cs index a4acbb4fd..d30c66580 100644 --- a/src/NadekoBot/Services/DbService.cs +++ b/src/NadekoBot/Services/DbService.cs @@ -1,4 +1,5 @@ -using Microsoft.Data.Sqlite; +#nullable disable +using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database; using LinqToDB.EntityFrameworkCore; @@ -53,4 +54,4 @@ public class DbService } public NadekoContext GetDbContext() => GetDbContextInternal(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/IBehaviourExecutor.cs b/src/NadekoBot/Services/IBehaviourExecutor.cs index 5d9ea8c0c..7830248bc 100644 --- a/src/NadekoBot/Services/IBehaviourExecutor.cs +++ b/src/NadekoBot/Services/IBehaviourExecutor.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public interface IBehaviourExecutor { @@ -8,4 +9,4 @@ public interface IBehaviourExecutor Task RunLateExecutorsAsync(SocketGuild guild, IUserMessage usrMsg); public void Initialize(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/ICoordinator.cs b/src/NadekoBot/Services/ICoordinator.cs index fda1acc13..4c4a0d7f5 100644 --- a/src/NadekoBot/Services/ICoordinator.cs +++ b/src/NadekoBot/Services/ICoordinator.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public interface ICoordinator { @@ -16,4 +17,4 @@ public class ShardStatus public DateTime LastUpdate { get; set; } public int ShardId { get; set; } public int GuildCount { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/ICurrencyService.cs b/src/NadekoBot/Services/ICurrencyService.cs index 1e12f85c1..e2c074abc 100644 --- a/src/NadekoBot/Services/ICurrencyService.cs +++ b/src/NadekoBot/Services/ICurrencyService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public interface ICurrencyService { @@ -8,4 +9,4 @@ public interface ICurrencyService Task RemoveAsync(ulong userId, string reason, long amount, bool gamble = false); Task RemoveAsync(IUser userId, string reason, long amount, bool sendMessage = false, bool gamble = false); Task RemoveBulkAsync(IEnumerable userIds, IEnumerable reasons, IEnumerable amounts, bool gamble = false); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/IDataCache.cs b/src/NadekoBot/Services/IDataCache.cs index d3006772c..4d54df986 100644 --- a/src/NadekoBot/Services/IDataCache.cs +++ b/src/NadekoBot/Services/IDataCache.cs @@ -1,4 +1,5 @@ -using StackExchange.Redis; +#nullable disable +using StackExchange.Redis; namespace NadekoBot.Services; @@ -25,4 +26,4 @@ public interface IDataCache Task GetOrAddCachedDataAsync(string key, Func> factory, TParam param, TimeSpan expiry) where TOut : class; DateTime GetLastCurrencyDecay(); void SetLastCurrencyDecay(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/IEmbedBuilderService.cs b/src/NadekoBot/Services/IEmbedBuilderService.cs index 9b3102575..c021d64a9 100644 --- a/src/NadekoBot/Services/IEmbedBuilderService.cs +++ b/src/NadekoBot/Services/IEmbedBuilderService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Configs; +#nullable disable +using NadekoBot.Common.Configs; namespace NadekoBot.Services; @@ -74,4 +75,4 @@ public sealed class DiscordEmbedBuilderWrapper : IEmbedBuilder _embed = eb; return this; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/IGoogleApiService.cs b/src/NadekoBot/Services/IGoogleApiService.cs index 52ae8b151..fb3696f62 100644 --- a/src/NadekoBot/Services/IGoogleApiService.cs +++ b/src/NadekoBot/Services/IGoogleApiService.cs @@ -1,4 +1,5 @@ -using Google.Apis.Customsearch.v1.Data; +#nullable disable +using Google.Apis.Customsearch.v1.Data; namespace NadekoBot.Services; @@ -29,4 +30,4 @@ public struct ImageResult this.Image = image; this.Link = link; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/IImageCache.cs b/src/NadekoBot/Services/IImageCache.cs index 0215e733c..f6e134155 100644 --- a/src/NadekoBot/Services/IImageCache.cs +++ b/src/NadekoBot/Services/IImageCache.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public interface IImageCache { @@ -25,4 +26,4 @@ public interface IImageCache byte[] GetCard(string key); Task Reload(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/ILocalDataCache.cs b/src/NadekoBot/Services/ILocalDataCache.cs index 260453f9d..445b36a93 100644 --- a/src/NadekoBot/Services/ILocalDataCache.cs +++ b/src/NadekoBot/Services/ILocalDataCache.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Pokemon; +#nullable disable +using NadekoBot.Common.Pokemon; using NadekoBot.Modules.Games.Common.Trivia; namespace NadekoBot.Services; @@ -9,4 +10,4 @@ public interface ILocalDataCache IReadOnlyDictionary PokemonAbilities { get; } IReadOnlyDictionary PokemonMap { get; } TriviaQuestion[] TriviaQuestions { get; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/ILocalization.cs b/src/NadekoBot/Services/ILocalization.cs index 16e831315..39e163c2e 100644 --- a/src/NadekoBot/Services/ILocalization.cs +++ b/src/NadekoBot/Services/ILocalization.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; namespace NadekoBot.Services; @@ -15,4 +16,4 @@ public interface ILocalization void SetDefaultCulture(CultureInfo ci); void SetGuildCulture(IGuild guild, CultureInfo ci); void SetGuildCulture(ulong guildId, CultureInfo ci); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/INService.cs b/src/NadekoBot/Services/INService.cs index 9beff0eb1..f9879b4e8 100644 --- a/src/NadekoBot/Services/INService.cs +++ b/src/NadekoBot/Services/INService.cs @@ -1,9 +1,9 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; /// /// All services must implement this interface in order to be auto-discovered by the DI system /// public interface INService { - -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/IStatsService.cs b/src/NadekoBot/Services/IStatsService.cs index 2137e9659..edfe5eeb0 100644 --- a/src/NadekoBot/Services/IStatsService.cs +++ b/src/NadekoBot/Services/IStatsService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public interface IStatsService { @@ -52,4 +53,4 @@ public interface IStatsService /// Gets total amount of private memory currently in use by the bot, in Megabytes. /// double GetPrivateMemory(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/BehaviorExecutor.cs b/src/NadekoBot/Services/Impl/BehaviorExecutor.cs index dfaa6bbf2..13c3ee36e 100644 --- a/src/NadekoBot/Services/Impl/BehaviorExecutor.cs +++ b/src/NadekoBot/Services/Impl/BehaviorExecutor.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using Microsoft.Extensions.DependencyInjection; namespace NadekoBot.Services; @@ -86,4 +87,4 @@ public sealed class BehaviorExecutor : IBehaviourExecutor, INService } } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/BotCredsProvider.cs b/src/NadekoBot/Services/Impl/BotCredsProvider.cs index 877271ddc..42f677533 100644 --- a/src/NadekoBot/Services/Impl/BotCredsProvider.cs +++ b/src/NadekoBot/Services/Impl/BotCredsProvider.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Configuration; +#nullable disable +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Primitives; using NadekoBot.Common.Yml; using Newtonsoft.Json; @@ -173,4 +174,4 @@ public sealed class BotCredsProvider : IBotCredsProvider } public IBotCredentials GetCreds() => _creds; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/CurrencyService.cs b/src/NadekoBot/Services/Impl/CurrencyService.cs index 1616ca3cc..8caac9090 100644 --- a/src/NadekoBot/Services/Impl/CurrencyService.cs +++ b/src/NadekoBot/Services/Impl/CurrencyService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database; +#nullable disable +using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; using NadekoBot.Db; using NadekoBot.Modules.Gambling.Services; @@ -143,4 +144,4 @@ public class CurrencyService : ICurrencyService, INService public Task RemoveAsync(IUser user, string reason, long amount, bool sendMessage = false, bool gamble = false) => InternalRemoveAsync(user.Id, user.Username, user.Discriminator, user.AvatarId, reason, amount, gamble); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/FontProvider.cs b/src/NadekoBot/Services/Impl/FontProvider.cs index 29d9523de..d38751028 100644 --- a/src/NadekoBot/Services/Impl/FontProvider.cs +++ b/src/NadekoBot/Services/Impl/FontProvider.cs @@ -1,4 +1,5 @@ -using SixLabors.Fonts; +#nullable disable +using SixLabors.Fonts; namespace NadekoBot.Services; @@ -59,4 +60,4 @@ public class FontProvider : INService ///
public Font RipFont { get; } public List FallBackFonts { get; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/GoogleApiService.cs b/src/NadekoBot/Services/Impl/GoogleApiService.cs index 2bcece9d2..aa2c29263 100644 --- a/src/NadekoBot/Services/Impl/GoogleApiService.cs +++ b/src/NadekoBot/Services/Impl/GoogleApiService.cs @@ -1,4 +1,5 @@ -using Google; +#nullable disable +using Google; using Google.Apis.Customsearch.v1; using Google.Apis.Services; using Google.Apis.Urlshortener.v1; @@ -378,4 +379,4 @@ public class GoogleApiService : IGoogleApiService, INService Languages.TryGetValue(language, out var mode); return mode; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/Localization.cs b/src/NadekoBot/Services/Impl/Localization.cs index 834dacd63..36979ad0b 100644 --- a/src/NadekoBot/Services/Impl/Localization.cs +++ b/src/NadekoBot/Services/Impl/Localization.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; using Newtonsoft.Json; using NadekoBot.Db; @@ -107,4 +108,4 @@ public class Localization : ILocalization, INService return toReturn; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/RedisCache.cs b/src/NadekoBot/Services/Impl/RedisCache.cs index 755ea3580..768af9004 100644 --- a/src/NadekoBot/Services/Impl/RedisCache.cs +++ b/src/NadekoBot/Services/Impl/RedisCache.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; using StackExchange.Redis; using System.Net; @@ -205,4 +206,4 @@ public class RedisCache : IDataCache db.StringSet($"{_redisKey}_last_currency_decay", JsonConvert.SerializeObject(DateTime.UtcNow)); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/RedisImageExtensions.cs b/src/NadekoBot/Services/Impl/RedisImageExtensions.cs index 935307163..219a802d2 100644 --- a/src/NadekoBot/Services/Impl/RedisImageExtensions.cs +++ b/src/NadekoBot/Services/Impl/RedisImageExtensions.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public static class RedisImageExtensions { @@ -7,4 +8,4 @@ public static class RedisImageExtensions public static Uri ToNewCdn(this Uri uri) => new(uri.ToString().Replace(OldCdnUrl, NewCdnUrl)); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/RedisImagesCache.cs b/src/NadekoBot/Services/Impl/RedisImagesCache.cs index ce215b05c..95d8cb728 100644 --- a/src/NadekoBot/Services/Impl/RedisImagesCache.cs +++ b/src/NadekoBot/Services/Impl/RedisImagesCache.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; using StackExchange.Redis; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Common.Yml; @@ -275,4 +276,4 @@ public sealed class RedisImagesCache : IImageCache, IReadyExecutor private RedisKey GetRedisKey(ImageKeys key) => _creds.RedisKey() + "_image_" + key; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/RedisLocalDataCache.cs b/src/NadekoBot/Services/Impl/RedisLocalDataCache.cs index 1146cef6f..81346542e 100644 --- a/src/NadekoBot/Services/Impl/RedisLocalDataCache.cs +++ b/src/NadekoBot/Services/Impl/RedisLocalDataCache.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Pokemon; +#nullable disable +using NadekoBot.Common.Pokemon; using NadekoBot.Modules.Games.Common.Trivia; using Newtonsoft.Json; using StackExchange.Redis; @@ -89,4 +90,4 @@ public class RedisLocalDataCache : ILocalDataCache private void Set(string key, object obj) => _con.GetDatabase().StringSet($"{_creds.RedisKey()}_localdata_{key}", JsonConvert.SerializeObject(obj)); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs b/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs index 8e4889028..e4b5ce1bb 100644 --- a/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs +++ b/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs @@ -1,4 +1,5 @@ -using Grpc.Core; +#nullable disable +using Grpc.Core; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Coordinator; @@ -129,4 +130,4 @@ public class RemoteGrpcCoordinator : ICoordinator, IReadyExecutor ConnState.Connected => ConnectionState.Connected, _ => ConnectionState.Disconnected }; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/SingleProcessCoordinator.cs b/src/NadekoBot/Services/Impl/SingleProcessCoordinator.cs index e74c9c2bf..c0418dd4a 100644 --- a/src/NadekoBot/Services/Impl/SingleProcessCoordinator.cs +++ b/src/NadekoBot/Services/Impl/SingleProcessCoordinator.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +#nullable disable +using System.Diagnostics; namespace NadekoBot.Services; @@ -53,4 +54,4 @@ public class SingleProcessCoordinator : ICoordinator public Task Reload() => Task.CompletedTask; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/SoundCloudApiService.cs b/src/NadekoBot/Services/Impl/SoundCloudApiService.cs index efd0fd26e..ee856ee15 100644 --- a/src/NadekoBot/Services/Impl/SoundCloudApiService.cs +++ b/src/NadekoBot/Services/Impl/SoundCloudApiService.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; namespace NadekoBot.Services; @@ -68,4 +69,4 @@ public class SoundCloudUser { [JsonProperty("username")] public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/StartingGuildsListService.cs b/src/NadekoBot/Services/Impl/StartingGuildsListService.cs index 048d1ce79..584311e1d 100644 --- a/src/NadekoBot/Services/Impl/StartingGuildsListService.cs +++ b/src/NadekoBot/Services/Impl/StartingGuildsListService.cs @@ -1,4 +1,5 @@ -using System.Collections.Immutable; +#nullable disable +using System.Collections.Immutable; using System.Collections; namespace NadekoBot.Services; @@ -15,4 +16,4 @@ public class StartingGuildsService : IEnumerable, INService IEnumerator IEnumerable.GetEnumerator() => _guilds.GetEnumerator(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index 95f97368d..319ce414d 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.ModuleBehaviors; +#nullable disable +using NadekoBot.Common.ModuleBehaviors; using System.Diagnostics; namespace NadekoBot.Services; @@ -169,4 +170,4 @@ public class StatsService : IStatsService, IReadyExecutor, INService, IDisposabl _currentProcess.Dispose(); GC.SuppressFinalize(this); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Impl/YtdlOperation.cs b/src/NadekoBot/Services/Impl/YtdlOperation.cs index d392d3e5a..63fcc758e 100644 --- a/src/NadekoBot/Services/Impl/YtdlOperation.cs +++ b/src/NadekoBot/Services/Impl/YtdlOperation.cs @@ -1,3 +1,4 @@ +#nullable disable using System.ComponentModel; using System.Diagnostics; using System.Text; @@ -70,4 +71,4 @@ public class YtdlOperation while((line = await process.StandardOutput.ReadLineAsync()) != null) yield return line; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/LogSetup.cs b/src/NadekoBot/Services/LogSetup.cs index df76cca36..e0daff6ad 100644 --- a/src/NadekoBot/Services/LogSetup.cs +++ b/src/NadekoBot/Services/LogSetup.cs @@ -1,4 +1,5 @@ -using System.Text; +#nullable disable +using System.Text; using Serilog.Events; using Serilog.Sinks.SystemConsole.Themes; @@ -32,4 +33,4 @@ public static class LogSetup return ConsoleTheme.None; #endif } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Settings/BotConfigService.cs b/src/NadekoBot/Services/Settings/BotConfigService.cs index dd1952650..da9d4bed0 100644 --- a/src/NadekoBot/Services/Settings/BotConfigService.cs +++ b/src/NadekoBot/Services/Settings/BotConfigService.cs @@ -1,4 +1,5 @@ -using NadekoBot.Common.Configs; +#nullable disable +using NadekoBot.Common.Configs; using SixLabors.ImageSharp.PixelFormats; namespace NadekoBot.Services; @@ -35,4 +36,4 @@ public sealed class BotConfigService : ConfigServiceBase ModifyConfig(c => c.Version = 2); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Settings/ConfigParsers.cs b/src/NadekoBot/Services/Settings/ConfigParsers.cs index 870cabc64..6f52eeb12 100644 --- a/src/NadekoBot/Services/Settings/ConfigParsers.cs +++ b/src/NadekoBot/Services/Settings/ConfigParsers.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; using SixLabors.ImageSharp.PixelFormats; namespace NadekoBot.Services; @@ -42,4 +43,4 @@ public static class ConfigPrinters public static string Color(Rgba32 color) => ((uint) ((color.B << 0) | (color.G << 8) | (color.R << 16))).ToString("X6"); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Settings/ConfigServiceBase.cs b/src/NadekoBot/Services/Settings/ConfigServiceBase.cs index 600d9a2e3..916edb120 100644 --- a/src/NadekoBot/Services/Settings/ConfigServiceBase.cs +++ b/src/NadekoBot/Services/Settings/ConfigServiceBase.cs @@ -1,4 +1,5 @@ -using System.Linq.Expressions; +#nullable disable +using System.Linq.Expressions; using System.Reflection; using NadekoBot.Common.Yml; using NadekoBot.Common.Configs; @@ -195,4 +196,4 @@ public abstract class ConfigServiceBase : IConfigService Save(); PublishChange(); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Settings/IConfigMigrator.cs b/src/NadekoBot/Services/Settings/IConfigMigrator.cs index 815c27815..6fc324c18 100644 --- a/src/NadekoBot/Services/Settings/IConfigMigrator.cs +++ b/src/NadekoBot/Services/Settings/IConfigMigrator.cs @@ -1,6 +1,7 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public interface IConfigMigrator { public void EnsureMigrated(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Settings/IConfigService.cs b/src/NadekoBot/Services/Settings/IConfigService.cs index 39ef81702..8ec90a31f 100644 --- a/src/NadekoBot/Services/Settings/IConfigService.cs +++ b/src/NadekoBot/Services/Settings/IConfigService.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; /// /// Interface that all services which deal with configs should implement @@ -39,4 +40,4 @@ public interface IConfigService /// Value to set the property to /// Success bool SetSetting(string prop, string newValue); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/Settings/SettingParser.cs b/src/NadekoBot/Services/Settings/SettingParser.cs index 49ff11355..73783ad18 100644 --- a/src/NadekoBot/Services/Settings/SettingParser.cs +++ b/src/NadekoBot/Services/Settings/SettingParser.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; /// /// Delegate which describes a parser which can convert string input into given data type /// /// Data type to convert string to -public delegate bool SettingParser(string input, out TData output); \ No newline at end of file +public delegate bool SettingParser(string input, out TData output); diff --git a/src/NadekoBot/Services/StandardConversions.cs b/src/NadekoBot/Services/StandardConversions.cs index e573e3f2e..6dec7709c 100644 --- a/src/NadekoBot/Services/StandardConversions.cs +++ b/src/NadekoBot/Services/StandardConversions.cs @@ -1,7 +1,8 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public static class StandardConversions { public static double CelsiusToFahrenheit(double cel) => (cel * 1.8f) + 32; -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/IBotStrings.cs b/src/NadekoBot/Services/strings/IBotStrings.cs index 211cee172..dcf35dd35 100644 --- a/src/NadekoBot/Services/strings/IBotStrings.cs +++ b/src/NadekoBot/Services/strings/IBotStrings.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; namespace NadekoBot.Services; @@ -12,4 +13,4 @@ public interface IBotStrings void Reload(); CommandStrings GetCommandStrings(string commandName, ulong? guildId = null); CommandStrings GetCommandStrings(string commandName, CultureInfo cultureInfo); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/IBotStringsProvider.cs b/src/NadekoBot/Services/strings/IBotStringsProvider.cs index 3593e2c19..920fb6410 100644 --- a/src/NadekoBot/Services/strings/IBotStringsProvider.cs +++ b/src/NadekoBot/Services/strings/IBotStringsProvider.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; /// /// Implemented by classes which provide localized strings in their own ways @@ -24,4 +25,4 @@ public interface IBotStringsProvider /// Language name /// Command name CommandStrings GetCommandStrings(string localeName, string commandName); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/IStringsSource.cs b/src/NadekoBot/Services/strings/IStringsSource.cs index 6eadf7aad..7122193f2 100644 --- a/src/NadekoBot/Services/strings/IStringsSource.cs +++ b/src/NadekoBot/Services/strings/IStringsSource.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; /// /// Basic interface used for classes implementing strings loading mechanism @@ -12,4 +13,4 @@ public interface IStringsSource Dictionary> GetResponseStrings(); Dictionary> GetCommandStrings(); -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/impl/BotStrings.cs b/src/NadekoBot/Services/strings/impl/BotStrings.cs index 2605767e6..44c3c319e 100644 --- a/src/NadekoBot/Services/strings/impl/BotStrings.cs +++ b/src/NadekoBot/Services/strings/impl/BotStrings.cs @@ -1,4 +1,5 @@ -using System.Globalization; +#nullable disable +using System.Globalization; using YamlDotNet.Serialization; namespace NadekoBot.Services; @@ -99,4 +100,4 @@ public class CommandStrings public string Desc { get; set; } [YamlMember(Alias = "args")] public string[] Args { get; set; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/impl/LocalBotStringsProvider.cs b/src/NadekoBot/Services/strings/impl/LocalBotStringsProvider.cs index 4b97ea924..ff958ff26 100644 --- a/src/NadekoBot/Services/strings/impl/LocalBotStringsProvider.cs +++ b/src/NadekoBot/Services/strings/impl/LocalBotStringsProvider.cs @@ -1,4 +1,5 @@ -namespace NadekoBot.Services; +#nullable disable +namespace NadekoBot.Services; public class LocalBotStringsProvider : IBotStringsProvider { @@ -39,4 +40,4 @@ public class LocalBotStringsProvider : IBotStringsProvider return null; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/impl/LocalFileStringsSource.cs b/src/NadekoBot/Services/strings/impl/LocalFileStringsSource.cs index 5e3da2855..862fa045b 100644 --- a/src/NadekoBot/Services/strings/impl/LocalFileStringsSource.cs +++ b/src/NadekoBot/Services/strings/impl/LocalFileStringsSource.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +#nullable disable +using Newtonsoft.Json; using YamlDotNet.Serialization; namespace NadekoBot.Services; @@ -69,4 +70,4 @@ public class LocalFileStringsSource : IStringsSource var secondDotIndex = fileName.LastIndexOf('.'); return fileName.Substring(dotIndex, secondDotIndex - dotIndex); } -} \ No newline at end of file +} diff --git a/src/NadekoBot/Services/strings/impl/RedisBotStringsProvider.cs b/src/NadekoBot/Services/strings/impl/RedisBotStringsProvider.cs index 62edea677..2cc54f3be 100644 --- a/src/NadekoBot/Services/strings/impl/RedisBotStringsProvider.cs +++ b/src/NadekoBot/Services/strings/impl/RedisBotStringsProvider.cs @@ -1,4 +1,5 @@ -using System.Web; +#nullable disable +using System.Web; using StackExchange.Redis; namespace NadekoBot.Services; @@ -72,4 +73,4 @@ public class RedisBotStringsProvider : IBotStringsProvider redisDb.HashSet($"{_creds.RedisKey()}:commands:{localeName}", hashFields); } } -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/ArrayExtensions.cs b/src/NadekoBot/_Extensions/ArrayExtensions.cs index ac1078f4c..e637d4ad8 100644 --- a/src/NadekoBot/_Extensions/ArrayExtensions.cs +++ b/src/NadekoBot/_Extensions/ArrayExtensions.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Extensions; +namespace NadekoBot.Extensions; // made for customreactions because they almost never get added // and they get looped through constantly @@ -34,4 +34,4 @@ public static class ArrayExtensions /// New array with updated elements public static TOut[] Map(this TIn[] arr, Func f) => Array.ConvertAll(arr, x => f(x)); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/BotCredentialsExtensions.cs b/src/NadekoBot/_Extensions/BotCredentialsExtensions.cs index 560a8fde8..faa7b6d8b 100644 --- a/src/NadekoBot/_Extensions/BotCredentialsExtensions.cs +++ b/src/NadekoBot/_Extensions/BotCredentialsExtensions.cs @@ -1,7 +1,7 @@ -namespace NadekoBot.Extensions; +namespace NadekoBot.Extensions; public static class BotCredentialsExtensions { public static bool IsOwner(this IBotCredentials creds, IUser user) => creds.OwnerIds.Contains(user.Id); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/EnumerableExtensions.cs b/src/NadekoBot/_Extensions/EnumerableExtensions.cs index 6ccd6171c..f9689df5a 100644 --- a/src/NadekoBot/_Extensions/EnumerableExtensions.cs +++ b/src/NadekoBot/_Extensions/EnumerableExtensions.cs @@ -1,4 +1,4 @@ -using System.Security.Cryptography; +using System.Security.Cryptography; using NadekoBot.Common.Collections; using NadekoBot.Services.Database.Models; @@ -14,7 +14,7 @@ public static class EnumerableExtensions /// Optional transformation to apply to each element before concatenation. /// The type of the members of values. /// A string that consists of the members of values delimited by the separator character. -or- Empty if values has no elements. - public static string Join(this IEnumerable data, char separator, Func func = null) + public static string Join(this IEnumerable data, char separator, Func? func = null) => string.Join(separator, data.Select(func ?? (x => x?.ToString() ?? string.Empty))); /// @@ -25,7 +25,7 @@ public static class EnumerableExtensions /// Optional transformation to apply to each element before concatenation. /// The type of the members of values. /// A string that consists of the members of values delimited by the separator character. -or- Empty if values has no elements. - public static string Join(this IEnumerable data, string separator, Func func = null) + public static string Join(this IEnumerable data, string separator, Func? func = null) => string.Join(separator, data.Select(func ?? (x => x?.ToString() ?? string.Empty))); /// @@ -66,6 +66,7 @@ public static class EnumerableExtensions /// A new instance of the class public static ConcurrentDictionary ToConcurrent( this IEnumerable> dict) + where TKey : notnull => new(dict); public static IndexedCollection ToIndexed(this IEnumerable enumerable) @@ -83,4 +84,4 @@ public static class EnumerableExtensions /// A task that represents the completion of all of the supplied tasks. public static Task WhenAll(this IEnumerable> tasks) => Task.WhenAll(tasks); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index 484a0ef83..e7ed4b2f8 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -1,4 +1,4 @@ -using Humanizer.Localisation; +using Humanizer.Localisation; using NadekoBot.Modules.Administration.Services; using SixLabors.Fonts; using SixLabors.ImageSharp; @@ -147,7 +147,7 @@ public static class Extensions ); private static string MethodName(this CommandInfo cmd) - => ((NadekoCommandAttribute)cmd.Attributes.FirstOrDefault(x => x is NadekoCommandAttribute))?.MethodName ?? + => ((NadekoCommandAttribute?)cmd.Attributes.FirstOrDefault(x => x is NadekoCommandAttribute))?.MethodName ?? cmd.Name; private static string GetFullUsage(string commandName, string args, string prefix) @@ -177,7 +177,7 @@ public static class Extensions this IUserMessage msg, DiscordSocketClient client, Func reactionAdded, - Func reactionRemoved = null) + Func? reactionRemoved = null) { if (reactionRemoved is null) reactionRemoved = _ => Task.CompletedTask; @@ -209,11 +209,8 @@ public static class Extensions ); } - public static IMessage DeleteAfter(this IUserMessage msg, int seconds, ILogCommandService logService = null) + public static IMessage DeleteAfter(this IUserMessage msg, int seconds, ILogCommandService? logService = null) { - if (msg is null) - return null; - Task.Run(async () => { await Task.Delay(seconds * 1000).ConfigureAwait(false); @@ -245,7 +242,7 @@ public static class Extensions return users.Where(u => u.RoleIds.Contains(role.Id)); } - public static string ToJson(this T any, JsonSerializerOptions options = null) + public static string ToJson(this T any, JsonSerializerOptions? options = null) => JsonSerializer.Serialize(any, options); /// @@ -276,7 +273,7 @@ public static class Extensions return opts; } - public static MemoryStream ToStream(this Image img, IImageFormat format = null) + public static MemoryStream ToStream(this Image img, IImageFormat? format = null) { var imageStream = new MemoryStream(); if (format?.Name == "GIF") @@ -307,7 +304,7 @@ public static class Extensions public static bool IsImage(this HttpResponseMessage msg) => IsImage(msg, out _); - public static bool IsImage(this HttpResponseMessage msg, out string mimeType) + public static bool IsImage(this HttpResponseMessage msg, out string? mimeType) { mimeType = msg.Content.Headers.ContentType?.MediaType; if (mimeType is "image/png" or "image/jpeg" or "image/gif") @@ -333,4 +330,4 @@ public static class Extensions public static string GetText(this IBotStrings strings, in LocStr str, CultureInfo culture) => strings.GetText(str.Key, culture, str.Params); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs index 1d9eb187c..4340f0b30 100644 --- a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs +++ b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Extensions; +namespace NadekoBot.Extensions; public static class MessageChannelExtensions { @@ -7,8 +7,8 @@ public static class MessageChannelExtensions public static Task SendAsync( this IMessageChannel channel, - string plainText, - Embed embed, + string? plainText, + Embed? embed, bool sanitizeAll = false) { plainText = sanitizeAll ? plainText?.SanitizeAllMentions() ?? "" : plainText?.SanitizeMentions() ?? ""; @@ -32,8 +32,8 @@ public static class MessageChannelExtensions IEmbedBuilderService eb, string title, string error, - string url = null, - string footer = null) + string? url = null, + string? footer = null) { var embed = eb.Create().WithErrorColor().WithDescription(error).WithTitle(title); @@ -58,8 +58,8 @@ public static class MessageChannelExtensions IEmbedBuilderService eb, string title, string text, - string url = null, - string footer = null) + string? url = null, + string? footer = null) { var embed = eb.Create().WithOkColor().WithDescription(text).WithTitle(title); @@ -223,4 +223,4 @@ public static class MessageChannelExtensions public static Task WarningAsync(this ICommandContext ctx) => ctx.Message.AddReactionAsync(new Emoji("⚠️")); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/LinkedListExtensions.cs b/src/NadekoBot/_Extensions/LinkedListExtensions.cs index 10bf790b5..dfe3cb711 100644 --- a/src/NadekoBot/_Extensions/LinkedListExtensions.cs +++ b/src/NadekoBot/_Extensions/LinkedListExtensions.cs @@ -1,5 +1,4 @@ -#nullable enable -namespace NadekoBot.Extensions; +namespace NadekoBot.Extensions; public static class LinkedListExtensions { @@ -16,4 +15,4 @@ public static class LinkedListExtensions return null; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/NumberExtensions.cs b/src/NadekoBot/_Extensions/NumberExtensions.cs index f15c2d210..95cc9ad13 100644 --- a/src/NadekoBot/_Extensions/NumberExtensions.cs +++ b/src/NadekoBot/_Extensions/NumberExtensions.cs @@ -1,4 +1,4 @@ -namespace NadekoBot.Extensions; +namespace NadekoBot.Extensions; public static class NumberExtensions { @@ -50,4 +50,4 @@ public static class NumberExtensions 0, TimeSpan.Zero ).AddSeconds(number); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/ProcessExtensions.cs b/src/NadekoBot/_Extensions/ProcessExtensions.cs index 86aba17ac..1ddfaf535 100644 --- a/src/NadekoBot/_Extensions/ProcessExtensions.cs +++ b/src/NadekoBot/_Extensions/ProcessExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // https://github.com/aspnet/Common/blob/dev/shared/Microsoft.Extensions.Process.Sources/ProcessHelper.cs @@ -79,7 +79,7 @@ public static class ProcessExtensions string fileName, string arguments, TimeSpan timeout, - out string stdout) + out string? stdout) { stdout = null; @@ -104,4 +104,4 @@ public static class ProcessExtensions return process.ExitCode; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/Rgba32Extensions.cs b/src/NadekoBot/_Extensions/Rgba32Extensions.cs index 0eb796d32..227ab1510 100644 --- a/src/NadekoBot/_Extensions/Rgba32Extensions.cs +++ b/src/NadekoBot/_Extensions/Rgba32Extensions.cs @@ -1,4 +1,4 @@ -using SixLabors.ImageSharp; +using SixLabors.ImageSharp; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.Formats.Png; @@ -54,4 +54,4 @@ public static class Rgba32Extensions canvas.Frames.RemoveFrame(0); return canvas; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/ServiceCollectionExtensions.cs b/src/NadekoBot/_Extensions/ServiceCollectionExtensions.cs index 5b514e414..61b3227b4 100644 --- a/src/NadekoBot/_Extensions/ServiceCollectionExtensions.cs +++ b/src/NadekoBot/_Extensions/ServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using Microsoft.Extensions.DependencyInjection; using NadekoBot.Modules.Music; using NadekoBot.Modules.Music.Resolvers; @@ -70,4 +70,4 @@ public static class ServiceCollectionExtensions services.AddSingleton(ConnectionMultiplexer.Connect(conf)); return services; } -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/StringExtensions.cs b/src/NadekoBot/_Extensions/StringExtensions.cs index f23ba5922..24471a9ad 100644 --- a/src/NadekoBot/_Extensions/StringExtensions.cs +++ b/src/NadekoBot/_Extensions/StringExtensions.cs @@ -14,7 +14,7 @@ public static class StringExtensions return str.PadLeft(padLeft).PadRight(length); } - public static T MapJson(this string str) + public static T? MapJson(this string str) => JsonConvert.DeserializeObject(str); private static readonly HashSet _lettersAndDigits = new(Enumerable.Range(48, 10) @@ -26,7 +26,7 @@ public static class StringExtensions public static string StripHtml(this string input) => Regex.Replace(input, "<.*?>", String.Empty); - public static string TrimTo(this string str, int maxLength, bool hideDots = false) + public static string? TrimTo(this string? str, int maxLength, bool hideDots = false) => hideDots ? str?.Truncate(maxLength, string.Empty) : str?.Truncate(maxLength); public static string ToTitleCase(this string str) @@ -148,4 +148,4 @@ public static class StringExtensions return newString; } ); -} \ No newline at end of file +} diff --git a/src/NadekoBot/_Extensions/UserExtensions.cs b/src/NadekoBot/_Extensions/UserExtensions.cs index 84e123bd5..465f56e22 100644 --- a/src/NadekoBot/_Extensions/UserExtensions.cs +++ b/src/NadekoBot/_Extensions/UserExtensions.cs @@ -1,4 +1,4 @@ -using NadekoBot.Db.Models; +using NadekoBot.Db.Models; namespace NadekoBot.Extensions; @@ -30,11 +30,11 @@ public static class UserExtensions => usr.AvatarId is null ? new(usr.GetDefaultAvatarUrl()) : new Uri(usr.GetAvatarUrl(ImageFormat.Auto, size)); // This method is only used for the xp card - public static Uri RealAvatarUrl(this DiscordUser usr) + public static Uri? RealAvatarUrl(this DiscordUser usr) => usr.AvatarId is null ? null : new Uri(usr.AvatarId.StartsWith("a_", StringComparison.InvariantCulture) ? $"{DiscordConfig.CDNUrl}avatars/{usr.UserId}/{usr.AvatarId}.gif" : $"{DiscordConfig.CDNUrl}avatars/{usr.UserId}/{usr.AvatarId}.png" ); -} \ No newline at end of file +}