From 4bc31476973e70f8af4c4db0f8e2726708e0b4ca Mon Sep 17 00:00:00 2001 From: Kwoth Date: Fri, 7 Apr 2023 00:41:31 +0200 Subject: [PATCH] More cleanup, namespace fixes, convenience methods for IKernel --- .../Abstractions/creds/IBotCredentials.cs | 2 - .../Abstractions/strings/IBotStrings.cs | 1 - src/Nadeko.Bot.Common/BotCommandTypeReader.cs | 2 - .../Common/TypeReaders/KwumTypeReader.cs | 2 - .../Extensions/ImagesharpExtensions.cs | 3 +- src/Nadeko.Bot.Common/IPermissionChecker.cs | 4 +- .../Interaction/NadekoInteractionService.cs | 4 +- .../ModuleBehaviors/IBehavior.cs | 6 + .../ModuleBehaviors/IExecNoCommand.cs | 2 +- .../ModuleBehaviors/IExecOnMessage.cs | 2 +- .../ModuleBehaviors/IExecPostCommand.cs | 2 +- .../ModuleBehaviors/IExecPreCommand.cs | 2 +- .../ModuleBehaviors/IInputTransformer.cs | 2 +- .../ModuleBehaviors/IReadyExecutor.cs | 2 +- .../Replacements/ReplacementBuilder.cs | 1 - .../Replacements/Replacer.cs | 1 - .../Services/Currency/DefaultWallet.cs | 1 - .../Services/ICommandHandler.cs | 5 +- .../Services/Impl/BehaviorExecutor.cs | 9 +- .../Impl/DiscordPermOverrideService.cs | 1 - .../Services/Impl/YtdlOperation.cs | 1 - .../Settings/ConfigServiceBase.cs | 1 - .../_Extensions/Extensions.cs | 2 - .../_Extensions/IMessageChannelExtensions.cs | 4 - .../SocketMessageComponentExtensions.cs | 6 +- .../_Extensions/UserExtensions.cs | 1 - .../Extensions/QuoteExtensions.cs | 1 - .../Mysql/20220409170652_mysql-init.cs | 3 +- .../Migrations/Mysql/20220429044757_bank.cs | 3 +- .../Mysql/20220504162509_new-rero.cs | 3 +- .../Mysql/20220614071410_patronage-system.cs | 3 +- .../Mysql/20220623090718_stondel-db-cache.cs | 3 +- .../Mysql/20220725155953_xpitemshop.cs | 3 +- ...220808141855_remove-obsolete-xp-columns.cs | 3 +- .../Mysql/20220916194514_autopub.cs | 3 +- .../Mysql/20221003175743_gambling-stats.cs | 3 +- .../PostgreSql/20220409170719_mysql-init.cs | 3 +- .../PostgreSql/20220429044808_bank.cs | 3 +- .../PostgreSql/20220504162457_new-rero.cs | 3 +- .../20220614071421_patronage-system.cs | 3 +- .../20220623090729_stondel-db-cache.cs | 3 +- .../PostgreSql/20220725155941_xpitemshop.cs | 3 +- ...220808142559_remove-obsolete-xp-columns.cs | 3 +- .../PostgreSql/20220916194523_autopub.cs | 3 +- .../20221003175752_gambling-stats.cs | 3 +- .../Sqlite/20210621042359_squash.cs | 3 +- .../Sqlite/20210707002343_cleanup.cs | 3 +- .../20210914180026_image-only-channels.cs | 3 +- .../20211015232708_nsfw-blacklist-tags.cs | 3 +- .../Sqlite/20211213145407_atl-rework.cs | 3 +- .../20220110105942_filter-settings-cleanup.cs | 3 +- .../Sqlite/20220409170828_clubs-refactor.cs | 3 +- .../Migrations/Sqlite/20220428051304_bank.cs | 3 +- .../Sqlite/20220503234243_new-rero.cs | 3 +- .../Sqlite/20220614071359_patronage-system.cs | 3 +- .../Sqlite/20220623073903_stondel-db-cache.cs | 3 +- .../Sqlite/20220725112348_xpitemshop.cs | 3 +- ...220808141842_remove-obsolete-xp-columns.cs | 3 +- .../Sqlite/20220916191702_autopub.cs | 3 +- .../Sqlite/20221003111019_gambling-stats.cs | 3 +- src/Nadeko.Bot.Db/Models/Permission.cs | 1 - src/Nadeko.Bot.Db/Models/Poll.cs | 2 - src/Nadeko.Bot.Db/Models/ShopEntry.cs | 2 - src/Nadeko.Bot.Db/NadekoContext.cs | 1 - .../SymbolExtensions.cs | 3 +- .../SyntaxReceiver.cs | 2 +- .../LocalizedStringsGenerator.cs | 6 +- .../AutoAssignRoleCommands.cs | 1 - .../Mute/MuteService.cs | 1 - .../DiscordPermOverrideCommands.cs | 3 - .../Role/RoleCommands.cs | 3 - .../Self/SelfService.cs | 1 - .../ServerLog/ServerLogCommandService.cs | 1 - .../VcRole/VcRoleService.cs | 1 - .../ExportedExpr.cs | 1 - .../NadekoExpressionExtensions.cs | 1 - .../NadekoExpressionsService.cs | 1 - .../Gambling/AnimalRacing/AnimalRace.cs | 1 - .../AnimalRacing/AnimalRacingCommands.cs | 1 - .../Gambling/Bank/BankService.cs | 1 - .../Gambling/BlackJack/BlackJackCommands.cs | 1 - .../Gambling/Events/GameStatusEvent.cs | 1 - .../Gambling/FlipCoin/FlipCoinCommands.cs | 1 - .../Gambling/GamblingConfigService.cs | 2 - .../Gambling/GamblingService.cs | 33 +++-- .../Gambling/GamblingTopLevelModule.cs | 3 - .../PlantPick/PlantAndPickCommands.cs | 1 - .../Gambling/Raffle/CurrencyRaffleCommands.cs | 1 - .../Gambling/Shop/ShopCommands.cs | 1 - .../Gambling/Shop/ShopService.cs | 1 - .../Gambling/Slot/SlotCommands.cs | 1 - .../Gambling/VoteRewardService.cs | 3 - .../Gambling/Waifus/WaifuClaimCommands.cs | 1 - .../Games/GamesService.cs | 2 - .../Games/GirlRating.cs | 1 - .../Games/Hangman/HangmanCommands.cs | 1 - .../CommandsOptions.cs | 1 - .../Services/MusicService.cs | 1 - .../_Common/Impl/MusicPlayer.cs | 1 - .../_Common/Resolvers/LocalTrackResolver.cs | 1 - .../_Common/Resolvers/SoundcloudResolver.cs | 1 - .../Blacklist/BlacklistCommands.cs | 1 - .../Crypto/CryptoService.cs | 1 - .../Feeds/FeedsService.cs | 1 - .../OsuCommands.cs | 1 - .../PathOfExileCommands.cs | 1 - .../PokemonSearchCommands.cs | 1 - .../SearchesService.cs | 1 - .../_Common/Extensions.cs | 1 - .../Models/StreamDataKey.cs | 1 - .../StreamNotifications/NotifChecker.cs | 3 +- .../Providers/TwitchHelixProvider.cs | 1 - .../_Common/Extensions.cs | 3 - .../Gambling/Betdraw/BetdrawGame.cs | 4 +- src/NadekoBot.Tests/BotStringsTests.cs | 1 - src/NadekoBot.Tests/GroupGreetTests.cs | 1 - src/NadekoBot.Tests/KwumTests.cs | 1 - src/NadekoBot.Tests/PubSubTests.cs | 1 - src/NadekoBot/Bot.cs | 74 ++++++----- .../Common/NinjectIKernelExtensions.cs | 43 +++++++ .../Common/ServiceCollectionExtensions.cs | 1 - .../Medusa/Adapters/BehaviorAdapter.cs | 10 +- .../Medusa/Adapters/ContextAdapterFactory.cs | 4 +- .../Medusa/Adapters/DmContextAdapter.cs | 4 - .../Medusa/Models/SnekCommandData.cs | 3 +- .../Medusae/IMedusaeRepositoryService.cs | 4 +- src/NadekoBot/Modules/Medusae/Medusa.cs | 3 +- src/NadekoBot/NadekoBot.csproj | 115 +++++++++--------- src/NadekoBot/Program.cs | 6 +- .../Services/Impl/RedisBotStringsProvider.cs | 1 - .../Services/Impl/RemoteGrpcCoordinator.cs | 1 - 131 files changed, 217 insertions(+), 338 deletions(-) create mode 100644 src/Nadeko.Bot.Common/ModuleBehaviors/IBehavior.cs rename src/{NadekoBot => Nadeko.Bot.Common}/Services/Impl/BehaviorExecutor.cs (97%) create mode 100644 src/NadekoBot/Common/NinjectIKernelExtensions.cs diff --git a/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs b/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs index ae7887ec6..6216f25e4 100644 --- a/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs +++ b/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs @@ -1,6 +1,4 @@ #nullable disable -using NadekoBot.Common; - namespace NadekoBot; public interface IBotCredentials diff --git a/src/Nadeko.Bot.Common/Abstractions/strings/IBotStrings.cs b/src/Nadeko.Bot.Common/Abstractions/strings/IBotStrings.cs index 3720ec642..924278a38 100644 --- a/src/Nadeko.Bot.Common/Abstractions/strings/IBotStrings.cs +++ b/src/Nadeko.Bot.Common/Abstractions/strings/IBotStrings.cs @@ -1,6 +1,5 @@ #nullable disable using System.Globalization; -using NadekoBot.Services; namespace NadekoBot.Common; diff --git a/src/Nadeko.Bot.Common/BotCommandTypeReader.cs b/src/Nadeko.Bot.Common/BotCommandTypeReader.cs index bd2ece7e4..da53651f5 100644 --- a/src/Nadeko.Bot.Common/BotCommandTypeReader.cs +++ b/src/Nadeko.Bot.Common/BotCommandTypeReader.cs @@ -1,6 +1,4 @@ #nullable disable -using NadekoBot.Services; - namespace NadekoBot.Common.TypeReaders; public sealed class CommandTypeReader : NadekoTypeReader diff --git a/src/Nadeko.Bot.Common/Common/TypeReaders/KwumTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/KwumTypeReader.cs index 3d0d288ef..166477621 100644 --- a/src/Nadeko.Bot.Common/Common/TypeReaders/KwumTypeReader.cs +++ b/src/Nadeko.Bot.Common/Common/TypeReaders/KwumTypeReader.cs @@ -1,6 +1,4 @@ #nullable disable -using Nadeko.Common; - namespace NadekoBot.Common.TypeReaders; public sealed class KwumTypeReader : NadekoTypeReader diff --git a/src/Nadeko.Bot.Common/Extensions/ImagesharpExtensions.cs b/src/Nadeko.Bot.Common/Extensions/ImagesharpExtensions.cs index 1386c3b7c..e34c5e361 100644 --- a/src/Nadeko.Bot.Common/Extensions/ImagesharpExtensions.cs +++ b/src/Nadeko.Bot.Common/Extensions/ImagesharpExtensions.cs @@ -1,5 +1,4 @@ -using SixLabors.Fonts; -using SixLabors.ImageSharp; +using SixLabors.ImageSharp; using SixLabors.ImageSharp.Drawing; using SixLabors.ImageSharp.Drawing.Processing; using SixLabors.ImageSharp.Formats; diff --git a/src/Nadeko.Bot.Common/IPermissionChecker.cs b/src/Nadeko.Bot.Common/IPermissionChecker.cs index f41a898cd..82d008a1a 100644 --- a/src/Nadeko.Bot.Common/IPermissionChecker.cs +++ b/src/Nadeko.Bot.Common/IPermissionChecker.cs @@ -1,6 +1,4 @@ -using NadekoBot; -using NadekoBot.Services; -using OneOf; +using OneOf; using OneOf.Types; namespace Nadeko.Bot.Common; diff --git a/src/Nadeko.Bot.Common/Interaction/NadekoInteractionService.cs b/src/Nadeko.Bot.Common/Interaction/NadekoInteractionService.cs index c0c54f61d..5f586b2cb 100644 --- a/src/Nadeko.Bot.Common/Interaction/NadekoInteractionService.cs +++ b/src/Nadeko.Bot.Common/Interaction/NadekoInteractionService.cs @@ -1,6 +1,4 @@ -using NadekoBot.Services; - -namespace NadekoBot; +namespace NadekoBot; public class NadekoInteractionService : INadekoInteractionService, INService { diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IBehavior.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IBehavior.cs new file mode 100644 index 000000000..49fe47f42 --- /dev/null +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IBehavior.cs @@ -0,0 +1,6 @@ +namespace NadekoBot.Common.ModuleBehaviors; + +public interface IBehavior +{ + public virtual string Name => this.GetType().Name; +} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecNoCommand.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecNoCommand.cs index 1edcf705c..46de13eff 100644 --- a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecNoCommand.cs +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecNoCommand.cs @@ -3,7 +3,7 @@ namespace NadekoBot.Common.ModuleBehaviors; /// /// Executed if no command was found for this message /// -public interface IExecNoCommand +public interface IExecNoCommand : IBehavior { /// /// Executed at the end of the lifecycle if no command was found diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecOnMessage.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecOnMessage.cs index 32f90d2a9..dad773ea1 100644 --- a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecOnMessage.cs +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecOnMessage.cs @@ -3,7 +3,7 @@ namespace NadekoBot.Common.ModuleBehaviors; /// /// Implemented by modules to handle non-bot messages received /// -public interface IExecOnMessage +public interface IExecOnMessage : IBehavior { int Priority { get; } diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPostCommand.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPostCommand.cs index 621b06bac..4bb35c585 100644 --- a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPostCommand.cs +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPostCommand.cs @@ -5,7 +5,7 @@ namespace NadekoBot.Common.ModuleBehaviors; /// ***There is no support for this method in NadekoBot services.*** /// It is only meant to be used in medusa system /// -public interface IExecPostCommand +public interface IExecPostCommand : IBehavior { /// /// Executed after a command was successfully executed diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPreCommand.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPreCommand.cs index 7f8b1f05d..847df698b 100644 --- a/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPreCommand.cs +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IExecPreCommand.cs @@ -4,7 +4,7 @@ namespace NadekoBot.Common.ModuleBehaviors; /// This interface's method is executed after a command was found but before it was executed. /// Able to block further processing of a command /// -public interface IExecPreCommand +public interface IExecPreCommand : IBehavior { public int Priority { get; } diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IInputTransformer.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IInputTransformer.cs index 7b320ae83..cc80cb763 100644 --- a/src/Nadeko.Bot.Common/ModuleBehaviors/IInputTransformer.cs +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IInputTransformer.cs @@ -3,7 +3,7 @@ namespace NadekoBot.Common.ModuleBehaviors; /// /// Implemented by services which may transform input before a command is searched for /// -public interface IInputTransformer +public interface IInputTransformer : IBehavior { /// /// Ran after a non-bot message was received diff --git a/src/Nadeko.Bot.Common/ModuleBehaviors/IReadyExecutor.cs b/src/Nadeko.Bot.Common/ModuleBehaviors/IReadyExecutor.cs index 78640b4d6..09b96358b 100644 --- a/src/Nadeko.Bot.Common/ModuleBehaviors/IReadyExecutor.cs +++ b/src/Nadeko.Bot.Common/ModuleBehaviors/IReadyExecutor.cs @@ -4,7 +4,7 @@ namespace NadekoBot.Common.ModuleBehaviors; /// All services which need to execute something after /// the bot is ready should implement this interface /// -public interface IReadyExecutor +public interface IReadyExecutor : IBehavior { /// /// Executed when bot is ready diff --git a/src/Nadeko.Bot.Common/Replacements/ReplacementBuilder.cs b/src/Nadeko.Bot.Common/Replacements/ReplacementBuilder.cs index 9b467bec6..d08f15090 100644 --- a/src/Nadeko.Bot.Common/Replacements/ReplacementBuilder.cs +++ b/src/Nadeko.Bot.Common/Replacements/ReplacementBuilder.cs @@ -1,6 +1,5 @@ #nullable disable using System.Text.RegularExpressions; -using NonBlocking; namespace NadekoBot.Common; diff --git a/src/Nadeko.Bot.Common/Replacements/Replacer.cs b/src/Nadeko.Bot.Common/Replacements/Replacer.cs index 2d049a95e..8c0c84d9f 100644 --- a/src/Nadeko.Bot.Common/Replacements/Replacer.cs +++ b/src/Nadeko.Bot.Common/Replacements/Replacer.cs @@ -1,6 +1,5 @@ #nullable disable using System.Text.RegularExpressions; -using Nadeko.Common; namespace NadekoBot.Common; diff --git a/src/Nadeko.Bot.Common/Services/Currency/DefaultWallet.cs b/src/Nadeko.Bot.Common/Services/Currency/DefaultWallet.cs index c8fa7c991..1bcc33121 100644 --- a/src/Nadeko.Bot.Common/Services/Currency/DefaultWallet.cs +++ b/src/Nadeko.Bot.Common/Services/Currency/DefaultWallet.cs @@ -1,6 +1,5 @@ using LinqToDB; using LinqToDB.EntityFrameworkCore; -using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; namespace NadekoBot.Services.Currency; diff --git a/src/Nadeko.Bot.Common/Services/ICommandHandler.cs b/src/Nadeko.Bot.Common/Services/ICommandHandler.cs index 5a6b893a4..5d1ea15b0 100644 --- a/src/Nadeko.Bot.Common/Services/ICommandHandler.cs +++ b/src/Nadeko.Bot.Common/Services/ICommandHandler.cs @@ -1,7 +1,4 @@ -using NadekoBot.Modules.Administration; -using NonBlocking; - -namespace NadekoBot.Services; +namespace NadekoBot.Services; public interface ICommandHandler { diff --git a/src/NadekoBot/Services/Impl/BehaviorExecutor.cs b/src/Nadeko.Bot.Common/Services/Impl/BehaviorExecutor.cs similarity index 97% rename from src/NadekoBot/Services/Impl/BehaviorExecutor.cs rename to src/Nadeko.Bot.Common/Services/Impl/BehaviorExecutor.cs index ce97a8d5b..d204dc7d1 100644 --- a/src/NadekoBot/Services/Impl/BehaviorExecutor.cs +++ b/src/Nadeko.Bot.Common/Services/Impl/BehaviorExecutor.cs @@ -1,12 +1,11 @@ #nullable disable using Microsoft.Extensions.DependencyInjection; using NadekoBot.Common.ModuleBehaviors; -using Ninject; namespace NadekoBot.Services; // should be renamed to handler as it's not only executing -public sealed class BehaviorHandler : IBehaviorHandler, INService +public sealed class BehaviorHandler : IBehaviorHandler { private readonly IServiceProvider _services; @@ -152,10 +151,8 @@ public sealed class BehaviorHandler : IBehaviorHandler, INService return false; } - private string GetExecName(object exec) - => exec is BehaviorAdapter ba - ? ba.ToString() - : exec.GetType().Name; + private string GetExecName(IBehavior exec) + => exec.Name; public async Task RunPreCommandAsync(ICommandContext ctx, CommandInfo cmd) { diff --git a/src/Nadeko.Bot.Common/Services/Impl/DiscordPermOverrideService.cs b/src/Nadeko.Bot.Common/Services/Impl/DiscordPermOverrideService.cs index dcc36b354..a513768b6 100644 --- a/src/Nadeko.Bot.Common/Services/Impl/DiscordPermOverrideService.cs +++ b/src/Nadeko.Bot.Common/Services/Impl/DiscordPermOverrideService.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Common/Services/Impl/YtdlOperation.cs b/src/Nadeko.Bot.Common/Services/Impl/YtdlOperation.cs index 96ea60d9c..84a424c78 100644 --- a/src/Nadeko.Bot.Common/Services/Impl/YtdlOperation.cs +++ b/src/Nadeko.Bot.Common/Services/Impl/YtdlOperation.cs @@ -2,7 +2,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Text; -using Nadeko.Common; namespace NadekoBot.Services; diff --git a/src/Nadeko.Bot.Common/Settings/ConfigServiceBase.cs b/src/Nadeko.Bot.Common/Settings/ConfigServiceBase.cs index 2f7fd5d1d..7031d17c3 100644 --- a/src/Nadeko.Bot.Common/Settings/ConfigServiceBase.cs +++ b/src/Nadeko.Bot.Common/Settings/ConfigServiceBase.cs @@ -2,7 +2,6 @@ using NadekoBot.Common.Configs; using NadekoBot.Common.Yml; using System.Linq.Expressions; using System.Reflection; -using NadekoBot.Common; namespace NadekoBot.Services; diff --git a/src/Nadeko.Bot.Common/_Extensions/Extensions.cs b/src/Nadeko.Bot.Common/_Extensions/Extensions.cs index 83934dbb4..62f897d68 100644 --- a/src/Nadeko.Bot.Common/_Extensions/Extensions.cs +++ b/src/Nadeko.Bot.Common/_Extensions/Extensions.cs @@ -4,8 +4,6 @@ using System.Globalization; using System.Text.Json; using System.Text.RegularExpressions; using Nadeko.Medusa; -using NadekoBot.Common; -using Serilog; namespace NadekoBot.Extensions; diff --git a/src/Nadeko.Bot.Common/_Extensions/IMessageChannelExtensions.cs b/src/Nadeko.Bot.Common/_Extensions/IMessageChannelExtensions.cs index 1d5b2c5f4..fe9cb1346 100644 --- a/src/Nadeko.Bot.Common/_Extensions/IMessageChannelExtensions.cs +++ b/src/Nadeko.Bot.Common/_Extensions/IMessageChannelExtensions.cs @@ -1,7 +1,3 @@ -using NadekoBot.Common; -using NadekoBot.Services; -using Serilog; - namespace NadekoBot.Extensions; public static class MessageChannelExtensions diff --git a/src/Nadeko.Bot.Common/_Extensions/SocketMessageComponentExtensions.cs b/src/Nadeko.Bot.Common/_Extensions/SocketMessageComponentExtensions.cs index ae0ef1ecf..a658eca6a 100644 --- a/src/Nadeko.Bot.Common/_Extensions/SocketMessageComponentExtensions.cs +++ b/src/Nadeko.Bot.Common/_Extensions/SocketMessageComponentExtensions.cs @@ -1,8 +1,4 @@ -using Nadeko.Common; -using NadekoBot.Common; -using NadekoBot.Services; - -namespace NadekoBot.Extensions; +namespace NadekoBot.Extensions; public static class SocketMessageComponentExtensions { diff --git a/src/Nadeko.Bot.Common/_Extensions/UserExtensions.cs b/src/Nadeko.Bot.Common/_Extensions/UserExtensions.cs index aeb7960db..79da0c824 100644 --- a/src/Nadeko.Bot.Common/_Extensions/UserExtensions.cs +++ b/src/Nadeko.Bot.Common/_Extensions/UserExtensions.cs @@ -1,5 +1,4 @@ using NadekoBot.Db.Models; -using NadekoBot.Services; namespace NadekoBot.Extensions; diff --git a/src/Nadeko.Bot.Db/Extensions/QuoteExtensions.cs b/src/Nadeko.Bot.Db/Extensions/QuoteExtensions.cs index e9fb1a5a4..74edc6c28 100644 --- a/src/Nadeko.Bot.Db/Extensions/QuoteExtensions.cs +++ b/src/Nadeko.Bot.Db/Extensions/QuoteExtensions.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Services.Database.Models; namespace NadekoBot.Db; diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220409170652_mysql-init.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220409170652_mysql-init.cs index 1c073f7ca..19c19557c 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220409170652_mysql-init.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220409170652_mysql-init.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220429044757_bank.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220429044757_bank.cs index 9e6221bc2..faaaac6fb 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220429044757_bank.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220429044757_bank.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220504162509_new-rero.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220504162509_new-rero.cs index ed110dfae..aa0b746da 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220504162509_new-rero.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220504162509_new-rero.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220614071410_patronage-system.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220614071410_patronage-system.cs index 7eb0bde01..15ec7684b 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220614071410_patronage-system.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220614071410_patronage-system.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220623090718_stondel-db-cache.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220623090718_stondel-db-cache.cs index 239bd2c50..8476e5b43 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220623090718_stondel-db-cache.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220623090718_stondel-db-cache.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220725155953_xpitemshop.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220725155953_xpitemshop.cs index ad43b1b09..bd0423d1e 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220725155953_xpitemshop.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220725155953_xpitemshop.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220808141855_remove-obsolete-xp-columns.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220808141855_remove-obsolete-xp-columns.cs index cbee10818..117abc0af 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220808141855_remove-obsolete-xp-columns.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220808141855_remove-obsolete-xp-columns.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20220916194514_autopub.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20220916194514_autopub.cs index 48cfc2051..3d304f28a 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20220916194514_autopub.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20220916194514_autopub.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Mysql/20221003175743_gambling-stats.cs b/src/Nadeko.Bot.Db/Migrations/Mysql/20221003175743_gambling-stats.cs index 1dcdc35a8..7d2c6beca 100644 --- a/src/Nadeko.Bot.Db/Migrations/Mysql/20221003175743_gambling-stats.cs +++ b/src/Nadeko.Bot.Db/Migrations/Mysql/20221003175743_gambling-stats.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220409170719_mysql-init.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220409170719_mysql-init.cs index d96bfdfc3..a93777118 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220409170719_mysql-init.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220409170719_mysql-init.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220429044808_bank.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220429044808_bank.cs index 89a42c8d1..dba272272 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220429044808_bank.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220429044808_bank.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220504162457_new-rero.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220504162457_new-rero.cs index dda26ab13..3eb9beb80 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220504162457_new-rero.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220504162457_new-rero.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220614071421_patronage-system.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220614071421_patronage-system.cs index c16ea5b4c..b6cfcbe9c 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220614071421_patronage-system.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220614071421_patronage-system.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220623090729_stondel-db-cache.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220623090729_stondel-db-cache.cs index 85a3ea497..f259316bf 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220623090729_stondel-db-cache.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220623090729_stondel-db-cache.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220725155941_xpitemshop.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220725155941_xpitemshop.cs index 2abb83149..68f19d786 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220725155941_xpitemshop.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220725155941_xpitemshop.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220808142559_remove-obsolete-xp-columns.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220808142559_remove-obsolete-xp-columns.cs index 5b8475221..d9fc309db 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220808142559_remove-obsolete-xp-columns.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220808142559_remove-obsolete-xp-columns.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220916194523_autopub.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220916194523_autopub.cs index 0db756926..637540fb2 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220916194523_autopub.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20220916194523_autopub.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20221003175752_gambling-stats.cs b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20221003175752_gambling-stats.cs index 8a18c56d8..3e565d273 100644 --- a/src/Nadeko.Bot.Db/Migrations/PostgreSql/20221003175752_gambling-stats.cs +++ b/src/Nadeko.Bot.Db/Migrations/PostgreSql/20221003175752_gambling-stats.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20210621042359_squash.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20210621042359_squash.cs index 54d5f8cd5..480028ca0 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20210621042359_squash.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20210621042359_squash.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20210707002343_cleanup.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20210707002343_cleanup.cs index 9196a4bd1..0dfb38293 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20210707002343_cleanup.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20210707002343_cleanup.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20210914180026_image-only-channels.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20210914180026_image-only-channels.cs index bf1cd0bc0..79a4da8b3 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20210914180026_image-only-channels.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20210914180026_image-only-channels.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20211015232708_nsfw-blacklist-tags.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20211015232708_nsfw-blacklist-tags.cs index d29059444..93760684b 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20211015232708_nsfw-blacklist-tags.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20211015232708_nsfw-blacklist-tags.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20211213145407_atl-rework.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20211213145407_atl-rework.cs index b1aba1b0e..51e57d2bc 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20211213145407_atl-rework.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20211213145407_atl-rework.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220110105942_filter-settings-cleanup.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220110105942_filter-settings-cleanup.cs index 8d5ce784a..9519576e1 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220110105942_filter-settings-cleanup.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220110105942_filter-settings-cleanup.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220409170828_clubs-refactor.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220409170828_clubs-refactor.cs index a2ce93ff6..c83624ce8 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220409170828_clubs-refactor.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220409170828_clubs-refactor.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220428051304_bank.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220428051304_bank.cs index bae81ec7b..a002407d6 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220428051304_bank.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220428051304_bank.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220503234243_new-rero.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220503234243_new-rero.cs index 9a1976765..f59d52c1a 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220503234243_new-rero.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220503234243_new-rero.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220614071359_patronage-system.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220614071359_patronage-system.cs index 0618bc44f..4ee3abfe1 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220614071359_patronage-system.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220614071359_patronage-system.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220623073903_stondel-db-cache.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220623073903_stondel-db-cache.cs index 10f477e02..4872eb004 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220623073903_stondel-db-cache.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220623073903_stondel-db-cache.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220725112348_xpitemshop.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220725112348_xpitemshop.cs index a6dac3bc7..898583fc6 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220725112348_xpitemshop.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220725112348_xpitemshop.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220808141842_remove-obsolete-xp-columns.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220808141842_remove-obsolete-xp-columns.cs index 1a50aee65..4c6b7c4fc 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220808141842_remove-obsolete-xp-columns.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220808141842_remove-obsolete-xp-columns.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220916191702_autopub.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220916191702_autopub.cs index 11f7eba80..4f9d26220 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20220916191702_autopub.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20220916191702_autopub.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Migrations/Sqlite/20221003111019_gambling-stats.cs b/src/Nadeko.Bot.Db/Migrations/Sqlite/20221003111019_gambling-stats.cs index 4481db082..e8c846af9 100644 --- a/src/Nadeko.Bot.Db/Migrations/Sqlite/20221003111019_gambling-stats.cs +++ b/src/Nadeko.Bot.Db/Migrations/Sqlite/20221003111019_gambling-stats.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Nadeko.Bot.Db/Models/Permission.cs b/src/Nadeko.Bot.Db/Models/Permission.cs index 66b12aad6..05fa4b727 100644 --- a/src/Nadeko.Bot.Db/Models/Permission.cs +++ b/src/Nadeko.Bot.Db/Models/Permission.cs @@ -1,7 +1,6 @@ #nullable disable using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics; -using Nadeko.Common; namespace NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Db/Models/Poll.cs b/src/Nadeko.Bot.Db/Models/Poll.cs index 75ec95cc5..6649217f6 100644 --- a/src/Nadeko.Bot.Db/Models/Poll.cs +++ b/src/Nadeko.Bot.Db/Models/Poll.cs @@ -1,6 +1,4 @@ #nullable disable -using Nadeko.Common; - namespace NadekoBot.Services.Database.Models; public class Poll : DbEntity diff --git a/src/Nadeko.Bot.Db/Models/ShopEntry.cs b/src/Nadeko.Bot.Db/Models/ShopEntry.cs index dc228a009..519456c77 100644 --- a/src/Nadeko.Bot.Db/Models/ShopEntry.cs +++ b/src/Nadeko.Bot.Db/Models/ShopEntry.cs @@ -1,6 +1,4 @@ #nullable disable -using Nadeko.Common; - namespace NadekoBot.Services.Database.Models; public enum ShopEntryType diff --git a/src/Nadeko.Bot.Db/NadekoContext.cs b/src/Nadeko.Bot.Db/NadekoContext.cs index 221d2bcfb..338b320cf 100644 --- a/src/Nadeko.Bot.Db/NadekoContext.cs +++ b/src/Nadeko.Bot.Db/NadekoContext.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; using NadekoBot.Db.Models; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Generators.Cloneable/SymbolExtensions.cs b/src/Nadeko.Bot.Generators.Cloneable/SymbolExtensions.cs index 6c0c6055e..8d6de76c5 100644 --- a/src/Nadeko.Bot.Generators.Cloneable/SymbolExtensions.cs +++ b/src/Nadeko.Bot.Generators.Cloneable/SymbolExtensions.cs @@ -1,8 +1,7 @@ // Code temporarily yeeted from // https://github.com/mostmand/Cloneable/blob/master/Cloneable/CloneableGenerator.cs // because of NRT issue -using System.Collections.Generic; -using System.Linq; + using Microsoft.CodeAnalysis; namespace Cloneable diff --git a/src/Nadeko.Bot.Generators.Cloneable/SyntaxReceiver.cs b/src/Nadeko.Bot.Generators.Cloneable/SyntaxReceiver.cs index 962c3957c..ae0d02933 100644 --- a/src/Nadeko.Bot.Generators.Cloneable/SyntaxReceiver.cs +++ b/src/Nadeko.Bot.Generators.Cloneable/SyntaxReceiver.cs @@ -1,7 +1,7 @@ // Code temporarily yeeted from // https://github.com/mostmand/Cloneable/blob/master/Cloneable/CloneableGenerator.cs // because of NRT issue -using System.Collections.Generic; + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Nadeko.Bot.Generators.Strings/LocalizedStringsGenerator.cs b/src/Nadeko.Bot.Generators.Strings/LocalizedStringsGenerator.cs index 4fe5cce09..790f07fd8 100644 --- a/src/Nadeko.Bot.Generators.Strings/LocalizedStringsGenerator.cs +++ b/src/Nadeko.Bot.Generators.Strings/LocalizedStringsGenerator.cs @@ -1,10 +1,6 @@ #nullable enable -using System; using System.CodeDom.Compiler; -using System.Collections.Generic; using System.Diagnostics; -using System.IO; -using System.Linq; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; using Newtonsoft.Json; @@ -43,7 +39,6 @@ namespace NadekoBot.Generators public void Initialize(GeneratorInitializationContext context) { - } public void Execute(GeneratorExecutionContext context) @@ -55,6 +50,7 @@ namespace NadekoBot.Generators using (var stringWriter = new StringWriter()) using (var sw = new IndentedTextWriter(stringWriter)) { + sw.WriteLine("#pragma warning disable CS8981"); sw.WriteLine("namespace NadekoBot;"); sw.WriteLine(); diff --git a/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs b/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs index 3fba8c5cb..791da0280 100644 --- a/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs +++ b/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; diff --git a/src/Nadeko.Bot.Modules.Administration/Mute/MuteService.cs b/src/Nadeko.Bot.Modules.Administration/Mute/MuteService.cs index b844fe672..872f50699 100644 --- a/src/Nadeko.Bot.Modules.Administration/Mute/MuteService.cs +++ b/src/Nadeko.Bot.Modules.Administration/Mute/MuteService.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Db; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideCommands.cs b/src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideCommands.cs index 122236855..469404715 100644 --- a/src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideCommands.cs +++ b/src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideCommands.cs @@ -1,8 +1,5 @@ #nullable disable -using Nadeko.Common; -using Nadeko.Bot.Db; using NadekoBot.Common.TypeReaders; -using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Administration; diff --git a/src/Nadeko.Bot.Modules.Administration/Role/RoleCommands.cs b/src/Nadeko.Bot.Modules.Administration/Role/RoleCommands.cs index 34296404a..77cfb65ba 100644 --- a/src/Nadeko.Bot.Modules.Administration/Role/RoleCommands.cs +++ b/src/Nadeko.Bot.Modules.Administration/Role/RoleCommands.cs @@ -1,8 +1,5 @@ #nullable disable -using NadekoBot.Modules.Administration.Services; -using NadekoBot.Services.Database.Models; using SixLabors.ImageSharp.PixelFormats; -using System.Net; using Color = SixLabors.ImageSharp.Color; namespace NadekoBot.Modules.Administration; diff --git a/src/Nadeko.Bot.Modules.Administration/Self/SelfService.cs b/src/Nadeko.Bot.Modules.Administration/Self/SelfService.cs index fa8a70ca0..9dab9b2b4 100644 --- a/src/Nadeko.Bot.Modules.Administration/Self/SelfService.cs +++ b/src/Nadeko.Bot.Modules.Administration/Self/SelfService.cs @@ -3,7 +3,6 @@ using Microsoft.EntityFrameworkCore; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Services.Database.Models; using System.Collections.Immutable; -using Nadeko.Common; namespace NadekoBot.Modules.Administration.Services; diff --git a/src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommandService.cs b/src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommandService.cs index 447bf2b1e..a36ac814f 100644 --- a/src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommandService.cs +++ b/src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommandService.cs @@ -1,6 +1,5 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; -using Nadeko.Common; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Db; using NadekoBot.Modules.Administration.Services; diff --git a/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs b/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs index 1f5ac2c68..adec30d3a 100644 --- a/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs +++ b/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Db; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Modules.Expresssions/ExportedExpr.cs b/src/Nadeko.Bot.Modules.Expresssions/ExportedExpr.cs index c91e7939d..b1b1383f8 100644 --- a/src/Nadeko.Bot.Modules.Expresssions/ExportedExpr.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/ExportedExpr.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.NadekoExpressions; diff --git a/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionExtensions.cs b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionExtensions.cs index c944a89b5..856733206 100644 --- a/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionExtensions.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionExtensions.cs @@ -1,7 +1,6 @@ #nullable disable using NadekoBot.Services.Database.Models; using System.Runtime.CompilerServices; -using NadekoBot.Extensions; namespace NadekoBot.Modules.NadekoExpressions; diff --git a/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs index 03a31f29e..1ed7a3e0c 100644 --- a/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs @@ -7,7 +7,6 @@ using NadekoBot.Services.Database.Models; using System.Runtime.CompilerServices; using LinqToDB.EntityFrameworkCore; using Nadeko.Bot.Common; -using Nadeko.Common; using NadekoBot.Services; using Serilog; using YamlDotNet.Serialization; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRace.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRace.cs index b05dcc830..b56e13109 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRace.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRace.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions; using NadekoBot.Modules.Games.Common; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingCommands.cs index 19d0b4c32..7ed2a971d 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.AnimalRacing; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankService.cs index 63f3063c1..e4a4d0f3b 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankService.cs @@ -1,6 +1,5 @@ using LinqToDB; using LinqToDB.EntityFrameworkCore; -using NadekoBot.Db.Models; namespace NadekoBot.Modules.Gambling.Bank; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackCommands.cs index 4979256c7..454cfc8e7 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.Blackjack; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/GameStatusEvent.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/GameStatusEvent.cs index db4dd1519..08ba310be 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/GameStatusEvent.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/GameStatusEvent.cs @@ -1,7 +1,6 @@ #nullable disable using NadekoBot.Services.Database.Models; using System.Collections.Concurrent; -using Nadeko.Common; namespace NadekoBot.Modules.Gambling.Common.Events; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipCoinCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipCoinCommands.cs index a12dd29b8..0954854e9 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipCoinCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipCoinCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs index d67072c6e..3f4bbefe6 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs @@ -1,8 +1,6 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Common.Configs; using NadekoBot.Modules.Gambling.Common; -using NadekoBot.Services; namespace NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs index 1ba66d96e..dbd796296 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs @@ -14,8 +14,6 @@ public class GamblingService : INService, IReadyExecutor public ConcurrentDictionary<(ulong, ulong), RollDuelGame> Duels { get; } = new(); public ConcurrentDictionary Connect4Games { get; } = new(); private readonly DbService _db; - private readonly ICurrencyService _cs; - private readonly IBot _bot; private readonly DiscordSocketClient _client; private readonly IBotCache _cache; private readonly GamblingConfigService _gss; @@ -24,13 +22,11 @@ public class GamblingService : INService, IReadyExecutor public GamblingService( DbService db, - ICurrencyService cs, DiscordSocketClient client, IBotCache cache, GamblingConfigService gss) { _db = db; - _cs = cs; _client = client; _cache = cache; _gss = gss; @@ -57,7 +53,7 @@ public class GamblingService : INService, IReadyExecutor var days = TimeSpan.FromDays(lifetime); await using var uow = _db.GetDbContext(); await uow.CurrencyTransactions - .DeleteAsync(ct => ct.DateAdded == null || now - ct.DateAdded < days); + .DeleteAsync(ct => ct.DateAdded == null || now - ct.DateAdded < days); } catch (Exception ex) { @@ -67,7 +63,7 @@ public class GamblingService : INService, IReadyExecutor } } } - + private async Task CurrencyDecayLoopAsync() { if (_client.ShardId != 0) @@ -84,7 +80,7 @@ public class GamblingService : INService, IReadyExecutor continue; var now = DateTime.UtcNow; - + await using var uow = _db.GetDbContext(); var result = await _cache.GetAsync(_curDecayKey); @@ -109,14 +105,14 @@ public class GamblingService : INService, IReadyExecutor var decay = (double)config.Decay.Percent; await uow.DiscordUser - .Where(x => x.CurrencyAmount > config.Decay.MinThreshold && x.UserId != _client.CurrentUser.Id) - .UpdateAsync(old => new() - { - CurrencyAmount = - maxDecay > Sql.Round((old.CurrencyAmount * decay) - 0.5) - ? (long)(old.CurrencyAmount - Sql.Round((old.CurrencyAmount * decay) - 0.5)) - : old.CurrencyAmount - maxDecay - }); + .Where(x => x.CurrencyAmount > config.Decay.MinThreshold && x.UserId != _client.CurrentUser.Id) + .UpdateAsync(old => new() + { + CurrencyAmount = + maxDecay > Sql.Round((old.CurrencyAmount * decay) - 0.5) + ? (long)(old.CurrencyAmount - Sql.Round((old.CurrencyAmount * decay) - 0.5)) + : old.CurrencyAmount - maxDecay + }); await uow.SaveChangesAsync(); @@ -145,7 +141,7 @@ public class GamblingService : INService, IReadyExecutor var waifus = uow.WaifuInfo.GetTotalValue(); var bot = await uow.DiscordUser.GetUserCurrencyAsync(_client.CurrentUser.Id); decimal bank = await uow.GetTable() - .SumAsyncLinqToDB(x => x.Balance); + .SumAsyncLinqToDB(x => x.Balance); var result = new EconomyResult { @@ -165,10 +161,11 @@ public class GamblingService : INService, IReadyExecutor } - private static readonly SemaphoreSlim _timelyLock = new (1, 1); + private static readonly SemaphoreSlim _timelyLock = new(1, 1); private static TypedKey> _timelyKey = new("timely:claims"); + public async Task ClaimTimelyAsync(ulong userId, int period) { if (period == 0) @@ -196,7 +193,7 @@ public class GamblingService : INService, IReadyExecutor // update the cache dict[userId] = nowB; await _cache.AddAsync(_timelyKey, dict); - + return null; } else diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs index 08bcf27f2..7fd6699cb 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs @@ -1,10 +1,7 @@ #nullable disable using NadekoBot.Modules.Gambling.Services; -using System.Globalization; using System.Numerics; -using Discord; using Nadeko.Bot.Common; -using NadekoBot.Common; namespace NadekoBot.Modules.Gambling.Common; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantAndPickCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantAndPickCommands.cs index a76a12fa4..672f787a1 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantAndPickCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantAndPickCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleCommands.cs index 675954a90..1dda32bc5 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Common.TypeReaders; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopCommands.cs index 0c7be3ede..8a2aa42a2 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopCommands.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Db; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopService.cs index 313360d86..fc02df61a 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopService.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Db; using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs index 2599f0d1b..8756a8d6e 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs @@ -7,7 +7,6 @@ using SixLabors.ImageSharp; using SixLabors.ImageSharp.Drawing.Processing; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using System.Text; using Nadeko.Econ.Gambling; using NadekoBot.Common.TypeReaders; using Color = SixLabors.ImageSharp.Color; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs index fc656b1e6..1a92cefdb 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs @@ -2,9 +2,6 @@ using NadekoBot.Common.ModuleBehaviors; using System.Text.Json; using System.Text.Json.Serialization; -using Discord.WebSocket; -using NadekoBot.Services; -using Serilog; namespace NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuClaimCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuClaimCommands.cs index 880f1c12d..9d014d086 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuClaimCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuClaimCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Modules.Gambling.Common; using NadekoBot.Modules.Gambling.Common.Waifu; using NadekoBot.Modules.Gambling.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Games/GamesService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/GamesService.cs index 435d052d5..bab88b185 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Games/GamesService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Games/GamesService.cs @@ -1,11 +1,9 @@ #nullable disable using Microsoft.Extensions.Caching.Memory; -using Nadeko.Common; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Modules.Games.Common; using NadekoBot.Modules.Games.Common.Acrophobia; using NadekoBot.Modules.Games.Common.Nunchi; -using NadekoBot.Modules.Games.Common.Trivia; using Newtonsoft.Json; namespace NadekoBot.Modules.Games.Services; diff --git a/src/Nadeko.Bot.Modules.Gambling/Games/GirlRating.cs b/src/Nadeko.Bot.Modules.Gambling/Games/GirlRating.cs index 731195ebd..3c7738b30 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Games/GirlRating.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Games/GirlRating.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing; using Image = SixLabors.ImageSharp.Image; diff --git a/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanCommands.cs index f519ba6e4..f0ae3f222 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanCommands.cs @@ -1,4 +1,3 @@ -using Nadeko.Common; using NadekoBot.Modules.Games.Hangman; namespace NadekoBot.Modules.Games; diff --git a/src/Nadeko.Bot.Modules.Help/CommandsOptions.cs b/src/Nadeko.Bot.Modules.Help/CommandsOptions.cs index d74d6b59c..b65df3b25 100644 --- a/src/Nadeko.Bot.Modules.Help/CommandsOptions.cs +++ b/src/Nadeko.Bot.Modules.Help/CommandsOptions.cs @@ -1,6 +1,5 @@ #nullable disable using CommandLine; -using NadekoBot.Common; namespace NadekoBot.Modules.Help.Common; diff --git a/src/Nadeko.Bot.Modules.Music/Services/MusicService.cs b/src/Nadeko.Bot.Modules.Music/Services/MusicService.cs index b20506ef7..cb49cf0c5 100644 --- a/src/Nadeko.Bot.Modules.Music/Services/MusicService.cs +++ b/src/Nadeko.Bot.Modules.Music/Services/MusicService.cs @@ -1,7 +1,6 @@ using NadekoBot.Db; using NadekoBot.Services.Database.Models; using System.Diagnostics.CodeAnalysis; -using Nadeko.Common; namespace NadekoBot.Modules.Music.Services; diff --git a/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlayer.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlayer.cs index 21b8d5980..963c90270 100644 --- a/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlayer.cs +++ b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlayer.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using Nadeko.Common; namespace NadekoBot.Modules.Music; diff --git a/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/LocalTrackResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/LocalTrackResolver.cs index 128bafdac..c5a07039e 100644 --- a/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/LocalTrackResolver.cs +++ b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/LocalTrackResolver.cs @@ -1,7 +1,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Text; -using Nadeko.Common; namespace NadekoBot.Modules.Music.Resolvers; diff --git a/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/SoundcloudResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/SoundcloudResolver.cs index 09d95e819..d4c0defd2 100644 --- a/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/SoundcloudResolver.cs +++ b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/SoundcloudResolver.cs @@ -1,7 +1,6 @@ using Newtonsoft.Json.Linq; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; -using Nadeko.Common; namespace NadekoBot.Modules.Music.Resolvers; diff --git a/src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistCommands.cs b/src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistCommands.cs index 6df32ba28..e51041a3e 100644 --- a/src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistCommands.cs +++ b/src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Modules.Permissions.Services; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Modules.Searches/Crypto/CryptoService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/CryptoService.cs index c5f9816e8..b791c1fee 100644 --- a/src/Nadeko.Bot.Modules.Searches/Crypto/CryptoService.cs +++ b/src/Nadeko.Bot.Modules.Searches/Crypto/CryptoService.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.Net.Http.Json; using System.Xml; using Color = SixLabors.ImageSharp.Color; -using JsonSerializer = System.Text.Json.JsonSerializer; using StringExtensions = NadekoBot.Extensions.StringExtensions; namespace NadekoBot.Modules.Searches.Services; diff --git a/src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs b/src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs index 774652f27..d14c2ceee 100644 --- a/src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs +++ b/src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs @@ -4,7 +4,6 @@ using CodeHollow.FeedReader.Feeds; using LinqToDB; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Db; using NadekoBot.Services.Database.Models; diff --git a/src/Nadeko.Bot.Modules.Searches/OsuCommands.cs b/src/Nadeko.Bot.Modules.Searches/OsuCommands.cs index 7db1cd377..60c568a9e 100644 --- a/src/Nadeko.Bot.Modules.Searches/OsuCommands.cs +++ b/src/Nadeko.Bot.Modules.Searches/OsuCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json; diff --git a/src/Nadeko.Bot.Modules.Searches/PathOfExileCommands.cs b/src/Nadeko.Bot.Modules.Searches/PathOfExileCommands.cs index d12acf3ac..fe801768e 100644 --- a/src/Nadeko.Bot.Modules.Searches/PathOfExileCommands.cs +++ b/src/Nadeko.Bot.Modules.Searches/PathOfExileCommands.cs @@ -5,7 +5,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Globalization; using System.Text; -using System.Text.RegularExpressions; namespace NadekoBot.Modules.Searches; diff --git a/src/Nadeko.Bot.Modules.Searches/PokemonSearchCommands.cs b/src/Nadeko.Bot.Modules.Searches/PokemonSearchCommands.cs index 7ff093fdf..0aa2b61a5 100644 --- a/src/Nadeko.Bot.Modules.Searches/PokemonSearchCommands.cs +++ b/src/Nadeko.Bot.Modules.Searches/PokemonSearchCommands.cs @@ -1,5 +1,4 @@ #nullable disable -using NadekoBot.Common.Pokemon; using NadekoBot.Modules.Searches.Services; namespace NadekoBot.Modules.Searches; diff --git a/src/Nadeko.Bot.Modules.Searches/SearchesService.cs b/src/Nadeko.Bot.Modules.Searches/SearchesService.cs index eedea43a1..984e5f7f9 100644 --- a/src/Nadeko.Bot.Modules.Searches/SearchesService.cs +++ b/src/Nadeko.Bot.Modules.Searches/SearchesService.cs @@ -1,6 +1,5 @@ #nullable disable using Html2Markdown; -using Nadeko.Common; using NadekoBot.Modules.Searches.Common; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs index e78f2a490..866707f10 100644 --- a/src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs @@ -1,5 +1,4 @@ using NadekoBot.Db.Models; -using NadekoBot.Modules.Searches.Common; namespace NadekoBot.Modules.Searches.Common; diff --git a/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamDataKey.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamDataKey.cs index bc01d37c6..8a55226cb 100644 --- a/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamDataKey.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamDataKey.cs @@ -1,6 +1,5 @@ #nullable disable using NadekoBot.Db.Models; -using System.Text.Json.Serialization; namespace NadekoBot.Modules.Searches.Common; diff --git a/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/NotifChecker.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/NotifChecker.cs index c3c30953f..be18267b4 100644 --- a/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/NotifChecker.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/NotifChecker.cs @@ -1,5 +1,4 @@ -using Nadeko.Common; -using NadekoBot.Db.Models; +using NadekoBot.Db.Models; using NadekoBot.Modules.Searches.Common.StreamNotifications.Providers; namespace NadekoBot.Modules.Searches.Common.StreamNotifications; diff --git a/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs index 0840b8e7a..c758cb0c1 100644 --- a/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs @@ -1,6 +1,5 @@ using NadekoBot.Db.Models; using System.Text.RegularExpressions; -using Nadeko.Common; using TwitchLib.Api; using JsonSerializer = System.Text.Json.JsonSerializer; diff --git a/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs b/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs index 31205dd40..39e505a04 100644 --- a/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs +++ b/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs @@ -1,7 +1,4 @@ #nullable disable -using LinqToDB; -using NadekoBot.Services.Database.Models; - namespace NadekoBot.Modules.Xp.Extensions; public static class Extensions diff --git a/src/Nadeko.Econ/Gambling/Betdraw/BetdrawGame.cs b/src/Nadeko.Econ/Gambling/Betdraw/BetdrawGame.cs index e0716a575..267a9b142 100644 --- a/src/Nadeko.Econ/Gambling/Betdraw/BetdrawGame.cs +++ b/src/Nadeko.Econ/Gambling/Betdraw/BetdrawGame.cs @@ -1,6 +1,4 @@ -using Serilog; - -namespace Nadeko.Econ.Gambling.Betdraw; +namespace Nadeko.Econ.Gambling.Betdraw; public sealed class BetdrawGame { diff --git a/src/NadekoBot.Tests/BotStringsTests.cs b/src/NadekoBot.Tests/BotStringsTests.cs index ce98cc989..bef6214a2 100644 --- a/src/NadekoBot.Tests/BotStringsTests.cs +++ b/src/NadekoBot.Tests/BotStringsTests.cs @@ -6,7 +6,6 @@ using Discord.Commands; using NadekoBot.Common; using NadekoBot.Common.Attributes; using NadekoBot.Services; -using NadekoBot.Modules; namespace NadekoBot.Tests { diff --git a/src/NadekoBot.Tests/GroupGreetTests.cs b/src/NadekoBot.Tests/GroupGreetTests.cs index ec8192cf4..a1497b6c4 100644 --- a/src/NadekoBot.Tests/GroupGreetTests.cs +++ b/src/NadekoBot.Tests/GroupGreetTests.cs @@ -1,7 +1,6 @@ using System.Linq; using System.Threading.Tasks; using Nadeko.Common; -using NadekoBot.Extensions; using NadekoBot.Services; using NUnit.Framework; diff --git a/src/NadekoBot.Tests/KwumTests.cs b/src/NadekoBot.Tests/KwumTests.cs index bffd3911e..1dcf021f3 100644 --- a/src/NadekoBot.Tests/KwumTests.cs +++ b/src/NadekoBot.Tests/KwumTests.cs @@ -1,5 +1,4 @@ using Nadeko.Common; -using NadekoBot.Common; using NUnit.Framework; namespace NadekoBot.Tests diff --git a/src/NadekoBot.Tests/PubSubTests.cs b/src/NadekoBot.Tests/PubSubTests.cs index 4870e130e..c32e23de6 100644 --- a/src/NadekoBot.Tests/PubSubTests.cs +++ b/src/NadekoBot.Tests/PubSubTests.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using Nadeko.Common; -using NadekoBot.Common; using NUnit.Framework; using NUnit.Framework.Internal; diff --git a/src/NadekoBot/Bot.cs b/src/NadekoBot/Bot.cs index 251d85bee..8f857d517 100644 --- a/src/NadekoBot/Bot.cs +++ b/src/NadekoBot/Bot.cs @@ -44,7 +44,7 @@ public sealed class Bot : IBot private readonly IBotCredsProvider _credsProvider; - private readonly Assembly[] _moduleAssemblies; + private readonly Assembly[] _loadedAssemblies; // private readonly InteractionService _interactionService; public Bot(int shardId, int? totalShards, string credPath = null) @@ -95,22 +95,15 @@ public sealed class Bot : IBot // _interactionService = new(Client.Rest); Client.Log += Client_Log; - _moduleAssemblies = new[] + _loadedAssemblies = new[] { typeof(Bot).Assembly, // bot typeof(Creds).Assembly, // bot.common // modules - typeof(NadekoExpressions).Assembly, - typeof(Administration).Assembly, - typeof(Gambling).Assembly, - typeof(Help).Assembly, - typeof(Music).Assembly, - typeof(Patronage).Assembly, - typeof(Permissions).Assembly, - typeof(Searches).Assembly, - typeof(Utility).Assembly, - typeof(Xp).Assembly, + typeof(NadekoExpressions).Assembly, typeof(Administration).Assembly, typeof(Gambling).Assembly, + typeof(Help).Assembly, typeof(Music).Assembly, typeof(Patronage).Assembly, typeof(Permissions).Assembly, + typeof(Searches).Assembly, typeof(Utility).Assembly, typeof(Xp).Assembly, }; } @@ -130,59 +123,62 @@ public sealed class Bot : IBot AllGuildConfigs = uow.GuildConfigs.GetAllGuildConfigs(startingGuildIdList).ToImmutableArray(); } - var kernel = new StandardKernel(new NinjectSettings() + var svcs = new StandardKernel(new NinjectSettings() { ThrowOnGetServiceNotFound = true, ActivationCacheDisabled = true, }); - kernel.Components.Remove(); - kernel.Components.Add(); + // this is required in order for medusa unloading to work + svcs.Components.Remove(); + svcs.Components.Add(); - kernel.Bind().ToMethod(_ => _credsProvider.GetCreds()).InTransientScope(); + svcs.AddSingleton(_ => _credsProvider.GetCreds()); + svcs.AddSingleton(_db); + svcs.AddSingleton(_credsProvider); + svcs.AddSingleton(Client); + svcs.AddSingleton(_commandService); + svcs.AddSingleton(this); + svcs.AddSingleton(this); - kernel.Bind().ToConstant(_credsProvider).InSingletonScope(); - kernel.Bind().ToConstant(_db).InSingletonScope(); - kernel.Bind().ToConstant(Client).InSingletonScope(); - kernel.Bind().ToConstant(_commandService).InSingletonScope(); - kernel.Bind().ToConstant(this).InSingletonScope(); - kernel.Bind().ToConstant(this).InSingletonScope(); - - kernel.Bind().To().InSingletonScope(); - kernel.Bind().To().InSingletonScope(); - kernel.Bind().ToConstant(new MemoryCache(new MemoryCacheOptions())).InSingletonScope(); + svcs.AddSingleton(); + svcs.AddSingleton(); + svcs.AddSingleton(new MemoryCache(new MemoryCacheOptions())); + svcs.AddSingleton(); - foreach (var a in _moduleAssemblies) + foreach (var a in _loadedAssemblies) { - kernel.AddConfigServices(a) - .AddConfigMigrators(a) - .AddLifetimeServices(a); + svcs.AddConfigServices(a) + .AddConfigMigrators(a) + .AddLifetimeServices(a); } - kernel.AddMusic() - .AddCache(_creds) - .AddHttpClients(); + svcs.AddMusic() + .AddCache(_creds) + .AddHttpClients(); if (Environment.GetEnvironmentVariable("NADEKOBOT_IS_COORDINATED") != "1") { - kernel.Bind().To().InSingletonScope(); + svcs.AddSingleton(); } else { - kernel.Bind().To().InSingletonScope(); + svcs.AddSingleton(); + svcs.AddSingleton(_ => svcs.GetRequiredService()); + svcs.AddSingleton(_ => svcs.GetRequiredService()); } - kernel.Bind().ToConstant(kernel).InSingletonScope(); + svcs.AddSingleton(svcs); //initialize Services - Services = kernel; + Services = svcs; Services.GetRequiredService().Initialize(); if (Client.ShardId == 0) ApplyConfigMigrations(); - foreach (var a in _moduleAssemblies) + foreach (var a in _loadedAssemblies) { LoadTypeReaders(a); } @@ -316,7 +312,7 @@ public sealed class Bot : IBot // start handling messages received in commandhandler await commandHandler.StartHandling(); - foreach (var a in _moduleAssemblies) + foreach (var a in _loadedAssemblies) { await _commandService.AddModulesAsync(a, Services); } diff --git a/src/NadekoBot/Common/NinjectIKernelExtensions.cs b/src/NadekoBot/Common/NinjectIKernelExtensions.cs new file mode 100644 index 000000000..fa26f243f --- /dev/null +++ b/src/NadekoBot/Common/NinjectIKernelExtensions.cs @@ -0,0 +1,43 @@ +using Ninject; + +namespace NadekoBot.Extensions; + +public static class NinjectIKernelExtensions +{ + public static IKernel AddSingleton(this IKernel kernel) + { + kernel.Bind().ToSelf().InSingletonScope(); + return kernel; + } + + public static IKernel AddSingleton(this IKernel kernel) + where TImpl : TInterface + { + kernel.Bind().To().InSingletonScope(); + return kernel; + } + + public static IKernel AddSingleton(this IKernel kernel, TImpl obj) + => kernel.AddSingleton(obj); + + public static IKernel AddSingleton(this IKernel kernel, TImpl obj) + where TImpl : TInterface + { + kernel.Bind().ToConstant(obj).InSingletonScope(); + return kernel; + } + + public static IKernel AddSingleton( + this IKernel kernel, + Func factory) + where TImpl : TInterface + { + kernel.Bind().ToMethod(factory).InSingletonScope(); + return kernel; + } + + public static IKernel AddSingleton( + this IKernel kernel, + Func factory) + => kernel.AddSingleton(factory); +} \ No newline at end of file diff --git a/src/NadekoBot/Common/ServiceCollectionExtensions.cs b/src/NadekoBot/Common/ServiceCollectionExtensions.cs index e4ebfaa28..72f69542f 100644 --- a/src/NadekoBot/Common/ServiceCollectionExtensions.cs +++ b/src/NadekoBot/Common/ServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using NadekoBot.Modules.Music; using NadekoBot.Modules.Music.Resolvers; using NadekoBot.Modules.Music.Services; diff --git a/src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs b/src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs index e08711757..7b6826fb4 100644 --- a/src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs +++ b/src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs @@ -1,9 +1,5 @@ #nullable enable -using Nadeko.Snake; -using NadekoBot.Common; -using NadekoBot.Services; - [DIIgnore] public sealed class BehaviorAdapter : ICustomBehavior { @@ -12,6 +8,8 @@ public sealed class BehaviorAdapter : ICustomBehavior private readonly IServiceProvider _services; private readonly string _name; + public string Name => _name; + // unused public int Priority => 0; @@ -53,7 +51,7 @@ public sealed class BehaviorAdapter : ICustomBehavior { if (!_snekWr.TryGetTarget(out var snek)) return null; - + return await snek.ExecInputTransformAsync(guild, channel, user, input); } @@ -69,7 +67,7 @@ public sealed class BehaviorAdapter : ICustomBehavior { if (!_snekWr.TryGetTarget(out var snek)) return; - + await snek.ExecPostCommandAsync(ContextAdapterFactory.CreateNew(context, _strings, _services), moduleName, commandName); diff --git a/src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs b/src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs index 5251a2f29..3f3be033c 100644 --- a/src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs +++ b/src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs @@ -1,6 +1,4 @@ -using Nadeko.Snake; - -internal class ContextAdapterFactory +internal class ContextAdapterFactory { public static AnyContext CreateNew(ICommandContext context, IMedusaStrings strings, IServiceProvider services) => context.Guild is null diff --git a/src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs b/src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs index aae890916..80cb115b0 100644 --- a/src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs +++ b/src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs @@ -1,8 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using Nadeko.Snake; -using NadekoBot; -using NadekoBot.Common; -using NadekoBot.Services; public sealed class DmContextAdapter : DmContext { diff --git a/src/NadekoBot/Medusa/Models/SnekCommandData.cs b/src/NadekoBot/Medusa/Models/SnekCommandData.cs index c1c3be3d5..2d800e428 100644 --- a/src/NadekoBot/Medusa/Models/SnekCommandData.cs +++ b/src/NadekoBot/Medusa/Models/SnekCommandData.cs @@ -1,5 +1,4 @@ -using Microsoft.VisualBasic; -using System.Reflection; +using System.Reflection; using CommandStrings = Nadeko.Snake.CommandStrings; namespace Nadeko.Medusa; diff --git a/src/NadekoBot/Modules/Medusae/IMedusaeRepositoryService.cs b/src/NadekoBot/Modules/Medusae/IMedusaeRepositoryService.cs index 4896a891b..769491181 100644 --- a/src/NadekoBot/Modules/Medusae/IMedusaeRepositoryService.cs +++ b/src/NadekoBot/Modules/Medusae/IMedusaeRepositoryService.cs @@ -1,6 +1,4 @@ -using NadekoBot.Modules; - -namespace NadekoBot.Modules; +namespace NadekoBot.Modules; public interface IMedusaeRepositoryService { diff --git a/src/NadekoBot/Modules/Medusae/Medusa.cs b/src/NadekoBot/Modules/Medusae/Medusa.cs index f1897c294..fc3035407 100644 --- a/src/NadekoBot/Modules/Medusae/Medusa.cs +++ b/src/NadekoBot/Modules/Medusae/Medusa.cs @@ -1,5 +1,4 @@ -using Nadeko.Common; -using Nadeko.Medusa; +using Nadeko.Medusa; namespace NadekoBot.Modules; diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index 1207377f8..4dc463df6 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -24,97 +24,97 @@ all True - - - - - - - - - + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - - + + + - - + + - - + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + all True - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - + + - + @@ -130,9 +130,6 @@ Always - - - 5.0.0 diff --git a/src/NadekoBot/Program.cs b/src/NadekoBot/Program.cs index 3fb6c5cd2..53b8fcde5 100644 --- a/src/NadekoBot/Program.cs +++ b/src/NadekoBot/Program.cs @@ -1,5 +1,3 @@ -using Nadeko.Common; - var pid = Environment.ProcessId; var shardId = 0; @@ -25,6 +23,6 @@ if (args.Length > 0 && args[0] != "run") } LogSetup.SetupLogger(shardId); -Log.Information("Pid: {ProcessId}", pid); - +Log.Information("Pid: {ProcessId}", pid); + await new Bot(shardId, totalShards, Environment.GetEnvironmentVariable("NadekoBot__creds")).RunAndBlockAsync(); \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/RedisBotStringsProvider.cs b/src/NadekoBot/Services/Impl/RedisBotStringsProvider.cs index 4087182d6..70f766392 100644 --- a/src/NadekoBot/Services/Impl/RedisBotStringsProvider.cs +++ b/src/NadekoBot/Services/Impl/RedisBotStringsProvider.cs @@ -1,7 +1,6 @@ #nullable disable using StackExchange.Redis; using System.Web; -using Nadeko.Common; namespace NadekoBot.Services; diff --git a/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs b/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs index e445fe5a4..6bfab0c80 100644 --- a/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs +++ b/src/NadekoBot/Services/Impl/RemoteGrpcCoordinator.cs @@ -1,7 +1,6 @@ #nullable disable using Grpc.Core; using Grpc.Net.Client; -using Nadeko.Common; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Coordinator;