diff --git a/NadekoBot.sln b/NadekoBot.sln index 4bb1b3a29..5cce753b9 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -35,13 +35,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Common", "src\Nadeko EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Econ", "src\Nadeko.Econ\Nadeko.Econ.csproj", "{4F4FBF7C-74F0-4AE4-B451-9E60BDCA9C37}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot.Modules.Expresssions", "src\NadekoBot.Modules.Expresssions\NadekoBot.Modules.Expresssions.csproj", "{92E239B9-C230-4475-9506-BED20174FD20}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Expresssions", "src\Nadeko.Bot.Modules.Expresssions\Nadeko.Bot.Modules.Expresssions.csproj", "{92E239B9-C230-4475-9506-BED20174FD20}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Db", "src\Nadeko.Bot.Db\Nadeko.Bot.Db.csproj", "{02499E3E-3B04-4BC8-9B3C-D9494661F78E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Common", "src\Nadeko.Bot.Common\Nadeko.Bot.Common.csproj", "{02ABC10E-3323-4698-A388-C61D7D03797E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Generators.Cloneable", "src\Nadeko.Bot.Generators.Cloneable\Nadeko.Bot.Generators.Cloneable.csproj", "{A5E71EE3-786E-438C-95C0-5BC558FCECCF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Gambling", "src\Nadeko.Bot.Modules.Gambling\Nadeko.Bot.Modules.Gambling.csproj", "{5F4F36A5-5874-4461-BB34-EE107E4B7F15}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -122,12 +122,12 @@ Global {02ABC10E-3323-4698-A388-C61D7D03797E}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU {02ABC10E-3323-4698-A388-C61D7D03797E}.Release|Any CPU.ActiveCfg = Release|Any CPU {02ABC10E-3323-4698-A388-C61D7D03797E}.Release|Any CPU.Build.0 = Release|Any CPU - {A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A5E71EE3-786E-438C-95C0-5BC558FCECCF}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU - {A5E71EE3-786E-438C-95C0-5BC558FCECCF}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU - {A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Release|Any CPU.Build.0 = Release|Any CPU + {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -146,7 +146,7 @@ Global {92E239B9-C230-4475-9506-BED20174FD20} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} {02499E3E-3B04-4BC8-9B3C-D9494661F78E} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} {02ABC10E-3323-4698-A388-C61D7D03797E} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} - {A5E71EE3-786E-438C-95C0-5BC558FCECCF} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {5F4F36A5-5874-4461-BB34-EE107E4B7F15} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5F3F555C-855F-4BE8-B526-D062D3E8ACA4} diff --git a/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs b/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs index 530bdce02..ae7887ec6 100644 --- a/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs +++ b/src/Nadeko.Bot.Common/Abstractions/creds/IBotCredentials.cs @@ -1,4 +1,6 @@ #nullable disable +using NadekoBot.Common; + namespace NadekoBot; public interface IBotCredentials @@ -9,14 +11,14 @@ public interface IBotCredentials bool UsePrivilegedIntents { get; } string RapidApiKey { get; } - IDbOptions Db { get; } + Creds.DbOptions Db { get; } string OsuApiKey { get; } int TotalShards { get; } - IPatreonSettings Patreon { get; } + Creds.PatreonSettings Patreon { get; } string CleverbotApiKey { get; } string Gpt3ApiKey { get; } - IRestartConfig RestartCommand { get; } - IVotesSettings Votes { get; } + RestartConfig RestartCommand { get; } + Creds.VotesSettings Votes { get; } string BotListToken { get; } string RedisOptions { get; } string LocationIqApiKey { get; } @@ -26,7 +28,7 @@ public interface IBotCredentials string CoordinatorUrl { get; set; } string TwitchClientId { get; set; } string TwitchClientSecret { get; set; } - IGoogleApiConfig Google { get; set; } + GoogleApiConfig Google { get; set; } BotCacheImplemenation BotCache { get; set; } } diff --git a/src/NadekoBot/Common/Attributes/AliasesAttribute.cs b/src/Nadeko.Bot.Common/Attributes/AliasesAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/AliasesAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/AliasesAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/CmdAttribute.cs b/src/Nadeko.Bot.Common/Attributes/CmdAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/CmdAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/CmdAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/DIIgnoreAttribute.cs b/src/Nadeko.Bot.Common/Attributes/DIIgnoreAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/DIIgnoreAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/DIIgnoreAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/NadekoOptionsAttribute.cs b/src/Nadeko.Bot.Common/Attributes/NadekoOptionsAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/NadekoOptionsAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/NadekoOptionsAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/NoPublicBotAttribute.cs b/src/Nadeko.Bot.Common/Attributes/NoPublicBotAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/NoPublicBotAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/NoPublicBotAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/OnlyPublicBotAttribute.cs b/src/Nadeko.Bot.Common/Attributes/OnlyPublicBotAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/OnlyPublicBotAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/OnlyPublicBotAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs b/src/Nadeko.Bot.Common/Attributes/OwnerOnlyAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/OwnerOnlyAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/RatelimitAttribute.cs b/src/Nadeko.Bot.Common/Attributes/RatelimitAttribute.cs similarity index 100% rename from src/NadekoBot/Common/Attributes/RatelimitAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/RatelimitAttribute.cs diff --git a/src/NadekoBot/Common/Attributes/UserPermAttribute.cs b/src/Nadeko.Bot.Common/Attributes/UserPermAttribute.cs similarity index 85% rename from src/NadekoBot/Common/Attributes/UserPermAttribute.cs rename to src/Nadeko.Bot.Common/Attributes/UserPermAttribute.cs index 31087cb2e..2e0af0369 100644 --- a/src/NadekoBot/Common/Attributes/UserPermAttribute.cs +++ b/src/Nadeko.Bot.Common/Attributes/UserPermAttribute.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using NadekoBot.Modules.Administration.Services; namespace Discord; @@ -21,7 +20,7 @@ public class UserPermAttribute : RequireUserPermissionAttribute CommandInfo command, IServiceProvider services) { - var permService = services.GetRequiredService(); + var permService = services.GetRequiredService(); if (permService.TryGetOverrides(context.Guild?.Id ?? 0, command.Name.ToUpperInvariant(), out _)) return Task.FromResult(PreconditionResult.FromSuccess()); diff --git a/src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs b/src/Nadeko.Bot.Common/BotCommandTypeReader.cs similarity index 87% rename from src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs rename to src/Nadeko.Bot.Common/BotCommandTypeReader.cs index 9a95ce854..bd2ece7e4 100644 --- a/src/NadekoBot/Common/TypeReaders/BotCommandTypeReader.cs +++ b/src/Nadeko.Bot.Common/BotCommandTypeReader.cs @@ -1,12 +1,14 @@ #nullable disable +using NadekoBot.Services; + namespace NadekoBot.Common.TypeReaders; public sealed class CommandTypeReader : NadekoTypeReader { private readonly CommandService _cmds; - private readonly CommandHandler _handler; + private readonly ICommandHandler _handler; - public CommandTypeReader(CommandHandler handler, CommandService cmds) + public CommandTypeReader(ICommandHandler handler, CommandService cmds) { _handler = handler; _cmds = cmds; diff --git a/src/NadekoBot/Modules/Permissions/CommandCooldown/CleverBotResponseStr.cs b/src/Nadeko.Bot.Common/CleverBotResponseStr.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/CommandCooldown/CleverBotResponseStr.cs rename to src/Nadeko.Bot.Common/CleverBotResponseStr.cs diff --git a/src/NadekoBot/Common/CommandNameLoadHelper.cs b/src/Nadeko.Bot.Common/CommandNameLoadHelper.cs similarity index 100% rename from src/NadekoBot/Common/CommandNameLoadHelper.cs rename to src/Nadeko.Bot.Common/CommandNameLoadHelper.cs diff --git a/src/NadekoBot/Common/AddRemove.cs b/src/Nadeko.Bot.Common/Common/AddRemove.cs similarity index 100% rename from src/NadekoBot/Common/AddRemove.cs rename to src/Nadeko.Bot.Common/Common/AddRemove.cs diff --git a/src/NadekoBot/Common/CmdStrings.cs b/src/Nadeko.Bot.Common/Common/CmdStrings.cs similarity index 100% rename from src/NadekoBot/Common/CmdStrings.cs rename to src/Nadeko.Bot.Common/Common/CmdStrings.cs diff --git a/src/NadekoBot/Common/CommandData.cs b/src/Nadeko.Bot.Common/Common/CommandData.cs similarity index 100% rename from src/NadekoBot/Common/CommandData.cs rename to src/Nadeko.Bot.Common/Common/CommandData.cs diff --git a/src/NadekoBot/Common/DownloadTracker.cs b/src/Nadeko.Bot.Common/Common/DownloadTracker.cs similarity index 100% rename from src/NadekoBot/Common/DownloadTracker.cs rename to src/Nadeko.Bot.Common/Common/DownloadTracker.cs diff --git a/src/NadekoBot/Common/Helpers.cs b/src/Nadeko.Bot.Common/Common/Helpers.cs similarity index 100% rename from src/NadekoBot/Common/Helpers.cs rename to src/Nadeko.Bot.Common/Common/Helpers.cs diff --git a/src/NadekoBot/Common/ImageUrls.cs b/src/Nadeko.Bot.Common/Common/ImageUrls.cs similarity index 100% rename from src/NadekoBot/Common/ImageUrls.cs rename to src/Nadeko.Bot.Common/Common/ImageUrls.cs diff --git a/src/NadekoBot/Common/JsonConverters/CultureInfoConverter.cs b/src/Nadeko.Bot.Common/Common/JsonConverters/CultureInfoConverter.cs similarity index 100% rename from src/NadekoBot/Common/JsonConverters/CultureInfoConverter.cs rename to src/Nadeko.Bot.Common/Common/JsonConverters/CultureInfoConverter.cs diff --git a/src/NadekoBot/Common/JsonConverters/Rgba32Converter.cs b/src/Nadeko.Bot.Common/Common/JsonConverters/Rgba32Converter.cs similarity index 100% rename from src/NadekoBot/Common/JsonConverters/Rgba32Converter.cs rename to src/Nadeko.Bot.Common/Common/JsonConverters/Rgba32Converter.cs diff --git a/src/NadekoBot/Common/LbOpts.cs b/src/Nadeko.Bot.Common/Common/LbOpts.cs similarity index 100% rename from src/NadekoBot/Common/LbOpts.cs rename to src/Nadeko.Bot.Common/Common/LbOpts.cs diff --git a/src/NadekoBot/Common/Linq2DbExpressions.cs b/src/Nadeko.Bot.Common/Common/Linq2DbExpressions.cs similarity index 100% rename from src/NadekoBot/Common/Linq2DbExpressions.cs rename to src/Nadeko.Bot.Common/Common/Linq2DbExpressions.cs diff --git a/src/NadekoBot/Common/LoginErrorHandler.cs b/src/Nadeko.Bot.Common/Common/LoginErrorHandler.cs similarity index 100% rename from src/NadekoBot/Common/LoginErrorHandler.cs rename to src/Nadeko.Bot.Common/Common/LoginErrorHandler.cs diff --git a/src/NadekoBot/Common/OldCreds.cs b/src/Nadeko.Bot.Common/Common/OldCreds.cs similarity index 100% rename from src/NadekoBot/Common/OldCreds.cs rename to src/Nadeko.Bot.Common/Common/OldCreds.cs diff --git a/src/NadekoBot/Common/OptionsParser.cs b/src/Nadeko.Bot.Common/Common/OptionsParser.cs similarity index 100% rename from src/NadekoBot/Common/OptionsParser.cs rename to src/Nadeko.Bot.Common/Common/OptionsParser.cs diff --git a/src/NadekoBot/Common/OsuMapData.cs b/src/Nadeko.Bot.Common/Common/OsuMapData.cs similarity index 100% rename from src/NadekoBot/Common/OsuMapData.cs rename to src/Nadeko.Bot.Common/Common/OsuMapData.cs diff --git a/src/NadekoBot/Common/OsuUserBets.cs b/src/Nadeko.Bot.Common/Common/OsuUserBets.cs similarity index 100% rename from src/NadekoBot/Common/OsuUserBets.cs rename to src/Nadeko.Bot.Common/Common/OsuUserBets.cs diff --git a/src/NadekoBot/Common/Pokemon/PokemonNameId.cs b/src/Nadeko.Bot.Common/Common/Pokemon/PokemonNameId.cs similarity index 100% rename from src/NadekoBot/Common/Pokemon/PokemonNameId.cs rename to src/Nadeko.Bot.Common/Common/Pokemon/PokemonNameId.cs diff --git a/src/NadekoBot/Common/Pokemon/SearchPokemon.cs b/src/Nadeko.Bot.Common/Common/Pokemon/SearchPokemon.cs similarity index 100% rename from src/NadekoBot/Common/Pokemon/SearchPokemon.cs rename to src/Nadeko.Bot.Common/Common/Pokemon/SearchPokemon.cs diff --git a/src/NadekoBot/Common/Pokemon/SearchPokemonAbility.cs b/src/Nadeko.Bot.Common/Common/Pokemon/SearchPokemonAbility.cs similarity index 100% rename from src/NadekoBot/Common/Pokemon/SearchPokemonAbility.cs rename to src/Nadeko.Bot.Common/Common/Pokemon/SearchPokemonAbility.cs diff --git a/src/NadekoBot/Common/RequireObjectPropertiesContractResolver.cs b/src/Nadeko.Bot.Common/Common/RequireObjectPropertiesContractResolver.cs similarity index 100% rename from src/NadekoBot/Common/RequireObjectPropertiesContractResolver.cs rename to src/Nadeko.Bot.Common/Common/RequireObjectPropertiesContractResolver.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/TriviaQuestionModel.cs b/src/Nadeko.Bot.Common/Common/TriviaQuestionModel.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/TriviaQuestionModel.cs rename to src/Nadeko.Bot.Common/Common/TriviaQuestionModel.cs diff --git a/src/NadekoBot/Common/TypeReaders/EmoteTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/EmoteTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/EmoteTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/EmoteTypeReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/GuildTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/GuildTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/GuildTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/GuildTypeReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/GuildUserTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/GuildUserTypeReader.cs similarity index 97% rename from src/NadekoBot/Common/TypeReaders/GuildUserTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/GuildUserTypeReader.cs index 1991443e5..837353f71 100644 --- a/src/NadekoBot/Common/TypeReaders/GuildUserTypeReader.cs +++ b/src/Nadeko.Bot.Common/Common/TypeReaders/GuildUserTypeReader.cs @@ -1,33 +1,33 @@ -namespace NadekoBot.Common.TypeReaders; - -public sealed class GuildUserTypeReader : NadekoTypeReader -{ - public override async ValueTask> ReadAsync(ICommandContext ctx, string input) - { - if (ctx.Guild is null) - return TypeReaderResult.FromError(CommandError.Unsuccessful, "Must be in a guild."); - - input = input.Trim(); - IGuildUser? user = null; - if (MentionUtils.TryParseUser(input, out var id)) - user = await ctx.Guild.GetUserAsync(id, CacheMode.AllowDownload); - - if (ulong.TryParse(input, out id)) - user = await ctx.Guild.GetUserAsync(id, CacheMode.AllowDownload); - - if (user is null) - { - var users = await ctx.Guild.GetUsersAsync(CacheMode.CacheOnly); - user = users.FirstOrDefault(x => x.Username == input) - ?? users.FirstOrDefault(x => - string.Equals(x.ToString(), input, StringComparison.InvariantCultureIgnoreCase)) - ?? users.FirstOrDefault(x => - string.Equals(x.Username, input, StringComparison.InvariantCultureIgnoreCase)); - } - - if (user is null) - return TypeReaderResult.FromError(CommandError.ObjectNotFound, "User not found."); - - return TypeReaderResult.FromSuccess(user); - } +namespace NadekoBot.Common.TypeReaders; + +public sealed class GuildUserTypeReader : NadekoTypeReader +{ + public override async ValueTask> ReadAsync(ICommandContext ctx, string input) + { + if (ctx.Guild is null) + return TypeReaderResult.FromError(CommandError.Unsuccessful, "Must be in a guild."); + + input = input.Trim(); + IGuildUser? user = null; + if (MentionUtils.TryParseUser(input, out var id)) + user = await ctx.Guild.GetUserAsync(id, CacheMode.AllowDownload); + + if (ulong.TryParse(input, out id)) + user = await ctx.Guild.GetUserAsync(id, CacheMode.AllowDownload); + + if (user is null) + { + var users = await ctx.Guild.GetUsersAsync(CacheMode.CacheOnly); + user = users.FirstOrDefault(x => x.Username == input) + ?? users.FirstOrDefault(x => + string.Equals(x.ToString(), input, StringComparison.InvariantCultureIgnoreCase)) + ?? users.FirstOrDefault(x => + string.Equals(x.Username, input, StringComparison.InvariantCultureIgnoreCase)); + } + + if (user is null) + return TypeReaderResult.FromError(CommandError.ObjectNotFound, "User not found."); + + return TypeReaderResult.FromSuccess(user); + } } \ No newline at end of file diff --git a/src/NadekoBot/Common/TypeReaders/KwumTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/KwumTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/KwumTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/KwumTypeReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/Models/PermissionAction.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/Models/PermissionAction.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/Models/PermissionAction.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/Models/PermissionAction.cs diff --git a/src/NadekoBot/Common/TypeReaders/Models/StoopidTime.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/Models/StoopidTime.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/Models/StoopidTime.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/Models/StoopidTime.cs diff --git a/src/NadekoBot/Common/TypeReaders/ModuleTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/ModuleTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/ModuleTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/ModuleTypeReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/PermissionActionTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/PermissionActionTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/PermissionActionTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/PermissionActionTypeReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/Rgba32TypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/Rgba32TypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/Rgba32TypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/Rgba32TypeReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/StoopidTimeTypeReader.cs b/src/Nadeko.Bot.Common/Common/TypeReaders/StoopidTimeTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/StoopidTimeTypeReader.cs rename to src/Nadeko.Bot.Common/Common/TypeReaders/StoopidTimeTypeReader.cs diff --git a/src/NadekoBot/Common/Creds.cs b/src/Nadeko.Bot.Common/Creds.cs similarity index 97% rename from src/NadekoBot/Common/Creds.cs rename to src/Nadeko.Bot.Common/Creds.cs index 00955513b..d3f20ff6c 100644 --- a/src/NadekoBot/Common/Creds.cs +++ b/src/Nadeko.Bot.Common/Creds.cs @@ -47,16 +47,16 @@ public sealed class Creds : IBotCredentials Do all steps again but enable image search for the ImageSearchId """)] - public IGoogleApiConfig Google { get; set; } + public GoogleApiConfig Google { get; set; } [Comment("""Settings for voting system for discordbots. Meant for use on global Nadeko.""")] - public IVotesSettings Votes { get; set; } + public VotesSettings Votes { get; set; } [Comment(""" Patreon auto reward system settings. go to https://www.patreon.com/portal -> my clients -> create client """)] - public IPatreonSettings Patreon { get; set; } + public PatreonSettings Patreon { get; set; } [Comment("""Api key for sending stats to DiscordBotList.""")] public string BotListToken { get; set; } @@ -81,7 +81,7 @@ public sealed class Creds : IBotCredentials public string RedisOptions { get; set; } [Comment("""Database options. Don't change if you don't know what you're doing. Leave null for default values""")] - public IDbOptions Db { get; set; } + public DbOptions Db { get; set; } [Comment(""" Address and port of the coordinator endpoint. Leave empty for default. @@ -143,7 +143,7 @@ public sealed class Creds : IBotCredentials cmd: NadekoBot.exe args: "{0}" """)] - public IRestartConfig RestartCommand { get; set; } + public RestartConfig RestartCommand { get; set; } public Creds() { diff --git a/src/NadekoBot/Services/Currency/CurrencyType.cs b/src/Nadeko.Bot.Common/Currency/CurrencyType.cs similarity index 100% rename from src/NadekoBot/Services/Currency/CurrencyType.cs rename to src/Nadeko.Bot.Common/Currency/CurrencyType.cs diff --git a/src/NadekoBot/Services/Currency/ICurrencyService.cs b/src/Nadeko.Bot.Common/Currency/ICurrencyService.cs similarity index 100% rename from src/NadekoBot/Services/Currency/ICurrencyService.cs rename to src/Nadeko.Bot.Common/Currency/ICurrencyService.cs diff --git a/src/NadekoBot/Services/Currency/ITxTracker.cs b/src/Nadeko.Bot.Common/Currency/ITxTracker.cs similarity index 100% rename from src/NadekoBot/Services/Currency/ITxTracker.cs rename to src/Nadeko.Bot.Common/Currency/ITxTracker.cs diff --git a/src/NadekoBot/Services/Currency/IWallet.cs b/src/Nadeko.Bot.Common/Currency/IWallet.cs similarity index 100% rename from src/NadekoBot/Services/Currency/IWallet.cs rename to src/Nadeko.Bot.Common/Currency/IWallet.cs diff --git a/src/NadekoBot/Services/Currency/TxData.cs b/src/Nadeko.Bot.Common/Currency/TxData.cs similarity index 100% rename from src/NadekoBot/Services/Currency/TxData.cs rename to src/Nadeko.Bot.Common/Currency/TxData.cs diff --git a/src/Nadeko.Bot.Common/GlobalUsings.cs b/src/Nadeko.Bot.Common/GlobalUsings.cs index 6029f602e..217849cb9 100644 --- a/src/Nadeko.Bot.Common/GlobalUsings.cs +++ b/src/Nadeko.Bot.Common/GlobalUsings.cs @@ -1,16 +1,16 @@ // // global using System.Collections.Concurrent; -// global using NonBlocking; +global using NonBlocking; // // // packages // global using Serilog; global using Humanizer; // // // nadekobot -// global using NadekoBot; -// global using NadekoBot.Services; +global using NadekoBot; +global using NadekoBot.Services; global using Nadeko.Common; // new project -// global using NadekoBot.Common; // old + nadekobot specific things -// global using NadekoBot.Common.Attributes; +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; global using NadekoBot.Extensions; // global using Nadeko.Snake; @@ -28,4 +28,7 @@ global using LeftoverAttribute = Discord.Commands.RemainderAttribute; // global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; // non-essential -global using JetBrains.Annotations; \ No newline at end of file +global using JetBrains.Annotations; + + +global using Serilog; \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/IBot.cs b/src/Nadeko.Bot.Common/IBot.cs new file mode 100644 index 000000000..2ad0078a7 --- /dev/null +++ b/src/Nadeko.Bot.Common/IBot.cs @@ -0,0 +1,12 @@ +#nullable disable +using NadekoBot.Services.Database.Models; + +namespace NadekoBot; + +public interface IBot +{ + IReadOnlyList GetCurrentGuildIds(); + event Func JoinedGuild; + IReadOnlyCollection AllGuildConfigs { get; } + bool IsReady { get; } +} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/ICurrencyProvider.cs b/src/Nadeko.Bot.Common/ICurrencyProvider.cs new file mode 100644 index 000000000..4341ac31a --- /dev/null +++ b/src/Nadeko.Bot.Common/ICurrencyProvider.cs @@ -0,0 +1,6 @@ +namespace Nadeko.Bot.Common; + +public interface ICurrencyProvider +{ + string GetCurrencySign(); +} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/IDiscordPermOverrideService.cs b/src/Nadeko.Bot.Common/IDiscordPermOverrideService.cs new file mode 100644 index 000000000..4ee2b27de --- /dev/null +++ b/src/Nadeko.Bot.Common/IDiscordPermOverrideService.cs @@ -0,0 +1,7 @@ +#nullable disable +namespace Nadeko.Common; + +public interface IDiscordPermOverrideService +{ + bool TryGetOverrides(ulong guildId, string commandName, out Nadeko.Bot.Db.GuildPerm? perm); +} \ No newline at end of file diff --git a/src/NadekoBot/Common/INadekoCommandOptions.cs b/src/Nadeko.Bot.Common/INadekoCommandOptions.cs similarity index 100% rename from src/NadekoBot/Common/INadekoCommandOptions.cs rename to src/Nadeko.Bot.Common/INadekoCommandOptions.cs diff --git a/src/Nadeko.Bot.Common/IPermissionChecker.cs b/src/Nadeko.Bot.Common/IPermissionChecker.cs new file mode 100644 index 000000000..90c9d68ab --- /dev/null +++ b/src/Nadeko.Bot.Common/IPermissionChecker.cs @@ -0,0 +1,15 @@ +using NadekoBot; +using NadekoBot.Services; +using OneOf; +using OneOf.Types; + +namespace Nadeko.Bot.Common; + +public interface IPermissionChecker +{ + Task>> CheckAsync(IGuild guild, + IMessageChannel channel, + IUser author, + string module, + string cmd); +} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj b/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj index e5ce4812d..95fe5b51f 100644 --- a/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj +++ b/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj @@ -15,10 +15,12 @@ + + all True @@ -29,9 +31,6 @@ - - PreserveNewest - - + diff --git a/src/NadekoBot/Common/TypeReaders/NadekoTypeReader.cs b/src/Nadeko.Bot.Common/NadekoTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/NadekoTypeReader.cs rename to src/Nadeko.Bot.Common/NadekoTypeReader.cs diff --git a/src/Nadeko.Bot.Common/Patronage/FeatureLimitKey.cs b/src/Nadeko.Bot.Common/Patronage/FeatureLimitKey.cs new file mode 100644 index 000000000..36780b0e2 --- /dev/null +++ b/src/Nadeko.Bot.Common/Patronage/FeatureLimitKey.cs @@ -0,0 +1,7 @@ +namespace NadekoBot.Modules.Utility.Patronage; + +public readonly struct FeatureLimitKey +{ + public string PrettyName { get; init; } + public string Key { get; init; } +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Utility/Patronage/FeatureQuotaStats.cs b/src/Nadeko.Bot.Common/Patronage/FeatureQuotaStats.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/FeatureQuotaStats.cs rename to src/Nadeko.Bot.Common/Patronage/FeatureQuotaStats.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/_common/IPatronData.cs b/src/Nadeko.Bot.Common/Patronage/IPatronData.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/_common/IPatronData.cs rename to src/Nadeko.Bot.Common/Patronage/IPatronData.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/_common/IPatronageService.cs b/src/Nadeko.Bot.Common/Patronage/IPatronageService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/_common/IPatronageService.cs rename to src/Nadeko.Bot.Common/Patronage/IPatronageService.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/_common/ISubscriptionHandler.cs b/src/Nadeko.Bot.Common/Patronage/ISubscriptionHandler.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/_common/ISubscriptionHandler.cs rename to src/Nadeko.Bot.Common/Patronage/ISubscriptionHandler.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Patron.cs b/src/Nadeko.Bot.Common/Patronage/Patron.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Patron.cs rename to src/Nadeko.Bot.Common/Patronage/Patron.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Config/PatronConfigData.cs b/src/Nadeko.Bot.Common/Patronage/PatronConfigData.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Config/PatronConfigData.cs rename to src/Nadeko.Bot.Common/Patronage/PatronConfigData.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/PatronExtensions.cs b/src/Nadeko.Bot.Common/Patronage/PatronExtensions.cs similarity index 84% rename from src/NadekoBot/Modules/Utility/Patronage/PatronExtensions.cs rename to src/Nadeko.Bot.Common/Patronage/PatronExtensions.cs index afd8a0d0f..e41fc66b5 100644 --- a/src/NadekoBot/Modules/Utility/Patronage/PatronExtensions.cs +++ b/src/Nadeko.Bot.Common/Patronage/PatronExtensions.cs @@ -2,12 +2,6 @@ public static class PatronExtensions { - public static DateOnly ToDateOnly(this DateTime dateTime) - => DateOnly.FromDateTime(dateTime); - - public static bool IsBeforeToday(this DateTime date) - => date < DateTime.UtcNow.Date; - public static string ToFullName(this PatronTier tier) => tier switch { diff --git a/src/NadekoBot/Modules/Utility/Patronage/Config/PatronTier.cs b/src/Nadeko.Bot.Common/Patronage/PatronTier.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Config/PatronTier.cs rename to src/Nadeko.Bot.Common/Patronage/PatronTier.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/QuotaLimit.cs b/src/Nadeko.Bot.Common/Patronage/QuotaLimit.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/QuotaLimit.cs rename to src/Nadeko.Bot.Common/Patronage/QuotaLimit.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Config/QuotaPer.cs b/src/Nadeko.Bot.Common/Patronage/QuotaPer.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Config/QuotaPer.cs rename to src/Nadeko.Bot.Common/Patronage/QuotaPer.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/SubscriptionChargeStatus.cs b/src/Nadeko.Bot.Common/Patronage/SubscriptionChargeStatus.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/SubscriptionChargeStatus.cs rename to src/Nadeko.Bot.Common/Patronage/SubscriptionChargeStatus.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/UserQuotaStats.cs b/src/Nadeko.Bot.Common/Patronage/UserQuotaStats.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/UserQuotaStats.cs rename to src/Nadeko.Bot.Common/Patronage/UserQuotaStats.cs diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/Nadeko.Bot.Common/Services/CommandHandler.cs similarity index 99% rename from src/NadekoBot/Services/CommandHandler.cs rename to src/Nadeko.Bot.Common/Services/CommandHandler.cs index 8671007bd..8fc9d6ac8 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/Nadeko.Bot.Common/Services/CommandHandler.cs @@ -24,7 +24,7 @@ public class CommandHandler : INService, IReadyExecutor, ICommandHandler private readonly DiscordSocketClient _client; private readonly CommandService _commandService; private readonly BotConfigService _bss; - private readonly Bot _bot; + private readonly IBot _bot; private readonly IBehaviorHandler _behaviorHandler; private readonly IServiceProvider _services; @@ -38,7 +38,7 @@ public class CommandHandler : INService, IReadyExecutor, ICommandHandler DbService db, CommandService commandService, BotConfigService bss, - Bot bot, + IBot bot, IBehaviorHandler behaviorHandler, // InteractionService interactions, IServiceProvider services) diff --git a/src/NadekoBot/Services/Currency/CurrencyService.cs b/src/Nadeko.Bot.Common/Services/Currency/CurrencyService.cs similarity index 100% rename from src/NadekoBot/Services/Currency/CurrencyService.cs rename to src/Nadeko.Bot.Common/Services/Currency/CurrencyService.cs diff --git a/src/NadekoBot/Services/Currency/CurrencyServiceExtensions.cs b/src/Nadeko.Bot.Common/Services/Currency/CurrencyServiceExtensions.cs similarity index 100% rename from src/NadekoBot/Services/Currency/CurrencyServiceExtensions.cs rename to src/Nadeko.Bot.Common/Services/Currency/CurrencyServiceExtensions.cs diff --git a/src/NadekoBot/Services/Currency/DefaultWallet.cs b/src/Nadeko.Bot.Common/Services/Currency/DefaultWallet.cs similarity index 100% rename from src/NadekoBot/Services/Currency/DefaultWallet.cs rename to src/Nadeko.Bot.Common/Services/Currency/DefaultWallet.cs diff --git a/src/NadekoBot/Services/Currency/GamblingTxTracker.cs b/src/Nadeko.Bot.Common/Services/Currency/GamblingTxTracker.cs similarity index 100% rename from src/NadekoBot/Services/Currency/GamblingTxTracker.cs rename to src/Nadeko.Bot.Common/Services/Currency/GamblingTxTracker.cs diff --git a/src/NadekoBot/Services/ILocalDataCache.cs b/src/Nadeko.Bot.Common/Services/ILocalDataCache.cs similarity index 100% rename from src/NadekoBot/Services/ILocalDataCache.cs rename to src/Nadeko.Bot.Common/Services/ILocalDataCache.cs diff --git a/src/Nadeko.Bot.Common/Services/IRemindService.cs b/src/Nadeko.Bot.Common/Services/IRemindService.cs new file mode 100644 index 000000000..e2276b717 --- /dev/null +++ b/src/Nadeko.Bot.Common/Services/IRemindService.cs @@ -0,0 +1,12 @@ +#nullable disable +namespace NadekoBot.Modules.Utility.Services; + +public interface IRemindService +{ + Task AddReminderAsync(ulong userId, + ulong targetId, + ulong? guildId, + bool isPrivate, + DateTime time, + string message); +} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/Services/IStatsService.cs b/src/Nadeko.Bot.Common/Services/IStatsService.cs index 37a093020..62f727e81 100644 --- a/src/Nadeko.Bot.Common/Services/IStatsService.cs +++ b/src/Nadeko.Bot.Common/Services/IStatsService.cs @@ -13,11 +13,6 @@ public interface IStatsService /// long CommandsRan { get; } - /// - /// The Discord framework used by the bot. - /// - string Library { get; } - /// /// The amount of messages seen by the bot since startup. /// diff --git a/src/NadekoBot/Services/Impl/FontProvider.cs b/src/Nadeko.Bot.Common/Services/Impl/FontProvider.cs similarity index 100% rename from src/NadekoBot/Services/Impl/FontProvider.cs rename to src/Nadeko.Bot.Common/Services/Impl/FontProvider.cs diff --git a/src/Nadeko.Bot.Common/Services/Impl/IImageCache.cs b/src/Nadeko.Bot.Common/Services/Impl/IImageCache.cs new file mode 100644 index 000000000..2c3cf916d --- /dev/null +++ b/src/Nadeko.Bot.Common/Services/Impl/IImageCache.cs @@ -0,0 +1,17 @@ +namespace NadekoBot.Services; + +public interface IImageCache +{ + Task GetHeadsImageAsync(); + Task GetTailsImageAsync(); + Task GetCurrencyImageAsync(); + Task GetXpBackgroundImageAsync(); + Task GetRategirlBgAsync(); + Task GetRategirlDotAsync(); + Task GetDiceAsync(int num); + Task GetSlotEmojiAsync(int number); + Task GetSlotBgAsync(); + Task GetRipBgAsync(); + Task GetRipOverlayAsync(); + Task GetImageDataAsync(Uri url); +} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/Services/Impl/ImagesConfig.cs b/src/Nadeko.Bot.Common/Services/Impl/ImagesConfig.cs new file mode 100644 index 000000000..f19aff44d --- /dev/null +++ b/src/Nadeko.Bot.Common/Services/Impl/ImagesConfig.cs @@ -0,0 +1,19 @@ +using NadekoBot.Common.Configs; + +namespace NadekoBot.Services; + +public sealed class ImagesConfig : ConfigServiceBase +{ + private const string PATH = "data/images.yml"; + + private static readonly TypedKey _changeKey = + new("config.images.updated"); + + public override string Name + => "images"; + + public ImagesConfig(IConfigSeria serializer, IPubSub pubSub) + : base(PATH, serializer, pubSub, _changeKey) + { + } +} \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/RedisImageExtensions.cs b/src/Nadeko.Bot.Common/Services/Impl/RedisImageExtensions.cs similarity index 100% rename from src/NadekoBot/Services/Impl/RedisImageExtensions.cs rename to src/Nadeko.Bot.Common/Services/Impl/RedisImageExtensions.cs diff --git a/src/NadekoBot/Services/Impl/SingleProcessCoordinator.cs b/src/Nadeko.Bot.Common/Services/Impl/SingleProcessCoordinator.cs similarity index 100% rename from src/NadekoBot/Services/Impl/SingleProcessCoordinator.cs rename to src/Nadeko.Bot.Common/Services/Impl/SingleProcessCoordinator.cs diff --git a/src/NadekoBot/Services/Impl/StartingGuildsListService.cs b/src/Nadeko.Bot.Common/Services/Impl/StartingGuildsListService.cs similarity index 100% rename from src/NadekoBot/Services/Impl/StartingGuildsListService.cs rename to src/Nadeko.Bot.Common/Services/Impl/StartingGuildsListService.cs diff --git a/src/NadekoBot/Services/Impl/YtdlOperation.cs b/src/Nadeko.Bot.Common/Services/Impl/YtdlOperation.cs similarity index 100% rename from src/NadekoBot/Services/Impl/YtdlOperation.cs rename to src/Nadeko.Bot.Common/Services/Impl/YtdlOperation.cs diff --git a/src/NadekoBot/Services/strings/impl/BotStrings.cs b/src/Nadeko.Bot.Common/Services/strings/impl/BotStrings.cs similarity index 100% rename from src/NadekoBot/Services/strings/impl/BotStrings.cs rename to src/Nadeko.Bot.Common/Services/strings/impl/BotStrings.cs diff --git a/src/NadekoBot/Services/strings/impl/LocalFileStringsSource.cs b/src/Nadeko.Bot.Common/Services/strings/impl/LocalFileStringsSource.cs similarity index 100% rename from src/NadekoBot/Services/strings/impl/LocalFileStringsSource.cs rename to src/Nadeko.Bot.Common/Services/strings/impl/LocalFileStringsSource.cs diff --git a/src/NadekoBot/Services/strings/impl/MemoryBotStringsProvider.cs b/src/Nadeko.Bot.Common/Services/strings/impl/MemoryBotStringsProvider.cs similarity index 100% rename from src/NadekoBot/Services/strings/impl/MemoryBotStringsProvider.cs rename to src/Nadeko.Bot.Common/Services/strings/impl/MemoryBotStringsProvider.cs diff --git a/src/NadekoBot/Common/TypeReaders/TypeReaderResult.cs b/src/Nadeko.Bot.Common/TypeReaderResult.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/TypeReaderResult.cs rename to src/Nadeko.Bot.Common/TypeReaderResult.cs diff --git a/src/Nadeko.Bot.Common/_Extensions/Extensions.cs b/src/Nadeko.Bot.Common/_Extensions/Extensions.cs index e81e8ab8e..83934dbb4 100644 --- a/src/Nadeko.Bot.Common/_Extensions/Extensions.cs +++ b/src/Nadeko.Bot.Common/_Extensions/Extensions.cs @@ -11,6 +11,12 @@ namespace NadekoBot.Extensions; public static class Extensions { + public static DateOnly ToDateOnly(this DateTime dateTime) + => DateOnly.FromDateTime(dateTime); + + public static bool IsBeforeToday(this DateTime date) + => date < DateTime.UtcNow.Date; + private static readonly Regex _urlRegex = new(@"^(https?|ftp)://(?[^\s/$.?#].[^\s]*)$", RegexOptions.Compiled); @@ -40,7 +46,7 @@ public static class Extensions public static ulong[] GetGuildIds(this DiscordSocketClient client) => client.Guilds - .Map(x => x.Id); + .Map(x => x.Id); /// /// Generates a string in the format HHH:mm if timespan is >= 2m. @@ -98,7 +104,7 @@ public static class Extensions { description = strings.GetCommandStrings(cmd.Summary, culture).Desc; } - + return string.Format(description, prefix); } @@ -123,7 +129,7 @@ public static class Extensions { args = strings.GetCommandStrings(cmd.Summary, culture).Args; } - + return args.Map(arg => GetFullUsage(cmd.Aliases.First(), arg, prefix)); } @@ -154,8 +160,13 @@ public static class Extensions if (logService is not null) logService.AddDeleteIgnore(msg.Id); - try { await msg.DeleteAsync(); } - catch { } + try + { + await msg.DeleteAsync(); + } + catch + { + } }); return msg; } diff --git a/src/Nadeko.Bot.Common/data/last_known_version.txt b/src/Nadeko.Bot.Common/data/last_known_version.txt deleted file mode 100644 index d18c8f478..000000000 --- a/src/Nadeko.Bot.Common/data/last_known_version.txt +++ /dev/null @@ -1 +0,0 @@ -4.3.13 \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.deps.json b/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.deps.json deleted file mode 100644 index f83b4fdbe..000000000 --- a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.deps.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v6.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v6.0": { - "NorthShirahebi/1.0.0": { - "dependencies": { - "Nadeko.Medusa": "4.3.10" - }, - "runtime": { - "NorthShirahebi.dll": {} - } - }, - "Discord.Net.Core/3.104.0": { - "dependencies": { - "Newtonsoft.Json": "13.0.1", - "System.Collections.Immutable": "5.0.0", - "System.Interactive.Async": "5.0.0", - "System.ValueTuple": "4.5.0" - } - }, - "Nadeko.Medusa/4.3.10": { - "dependencies": { - "Discord.Net.Core": "3.104.0", - "Serilog": "2.11.0", - "YamlDotNet": "11.2.1" - } - }, - "Newtonsoft.Json/13.0.1": {}, - "Serilog/2.11.0": {}, - "System.Collections.Immutable/5.0.0": {}, - "System.Interactive.Async/5.0.0": { - "dependencies": { - "System.Linq.Async": "5.0.0" - } - }, - "System.Linq.Async/5.0.0": {}, - "System.ValueTuple/4.5.0": {}, - "YamlDotNet/11.2.1": {} - } - }, - "libraries": { - "NorthShirahebi/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Discord.Net.Core/3.104.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-kGCH8WA5C39oLGNb/4+r6M038BKnrxNFyjFZ0YPUiNXPki3CGCugMleSvPjUcUaz7UnvOFA9W8JzgN6KQWbuOQ==", - "path": "discord.net.core/3.104.0", - "hashPath": "discord.net.core.3.104.0.nupkg.sha512" - }, - "Nadeko.Medusa/4.3.10": { - "type": "package", - "serviceable": true, - "sha512": "sha512-vwuTD/Gu+6SBU5wG+wnaijcbjkAiYiQK2oTKCiJnP5uqWtLD33pTAoXNkMMu0soQj1hetFVoDUUbMLeg/JLAKg==", - "path": "nadeko.medusa/4.3.10", - "hashPath": "nadeko.medusa.4.3.10.nupkg.sha512" - }, - "Newtonsoft.Json/13.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==", - "path": "newtonsoft.json/13.0.1", - "hashPath": "newtonsoft.json.13.0.1.nupkg.sha512" - }, - "Serilog/2.11.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ysv+hBzTul6Dp+Hvm10FlhJO3yMQcFKSAleus+LpiIzvNstpeV4Z7gGuIZ1OPNfIMulSHOjmLuGAEDKzpnV8ZQ==", - "path": "serilog/2.11.0", - "hashPath": "serilog.2.11.0.nupkg.sha512" - }, - "System.Collections.Immutable/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==", - "path": "system.collections.immutable/5.0.0", - "hashPath": "system.collections.immutable.5.0.0.nupkg.sha512" - }, - "System.Interactive.Async/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==", - "path": "system.interactive.async/5.0.0", - "hashPath": "system.interactive.async.5.0.0.nupkg.sha512" - }, - "System.Linq.Async/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==", - "path": "system.linq.async/5.0.0", - "hashPath": "system.linq.async.5.0.0.nupkg.sha512" - }, - "System.ValueTuple/4.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==", - "path": "system.valuetuple/4.5.0", - "hashPath": "system.valuetuple.4.5.0.nupkg.sha512" - }, - "YamlDotNet/11.2.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-tBt8K+korVfrjH9wyDEhiLKxbs8qoLCLIFwvYgkSUuMC9//w3z0cFQ8LQAI/5MCKq+BMil0cfRTRvPeE7eXhQw==", - "path": "yamldotnet/11.2.1", - "hashPath": "yamldotnet.11.2.1.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.dll b/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.dll deleted file mode 100644 index 8eaf4ca0a..000000000 Binary files a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.dll and /dev/null differ diff --git a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.runtimeconfig.json b/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.runtimeconfig.json deleted file mode 100644 index 32dca81c1..000000000 --- a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/NorthShirahebi.runtimeconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net6.0", - "rollForward": "LatestMinor", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "6.0.0" - } - } -} \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/cmds.yml b/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/cmds.yml deleted file mode 100644 index e682c1dec..000000000 --- a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/cmds.yml +++ /dev/null @@ -1,70 +0,0 @@ -hug: - desc: "Hug a friend!" - args: - - "" - - "@someone" - -kiss: - desc: "K-kiss someone s-special!" - args: - - "" - - "@someone" - -pat: - desc: "A good boy deserves pats." - args: - - "" - - "@someone" - -cuddle: - desc: "Cuddle your lover. ...Or yourself." - args: - - "" - - "@someone" - -wave: - desc: "Greet your friends with a friendly wave." - args: - - "" - - "@someone" - -catgirl: - desc: "Spawn a random catgirl!" - args: - - "" -Rain: - desc: "Spawn a random image with a rainy scenery." - args: - - "" -Weapon: - desc: "Spawn a random image featuring weapon(s)." - args: - - "" -Mountain: - desc: "Spawn a random image with a mountainous scenery." - args: - - "" -Swimmingpool: - desc: "Spawn a random image featuring a swimming pool(?)." - args: - - "" -Sportswear: - desc: "Spawn a random image with one or more characters wearing sportswear." - args: - - "" -Baggyclothes: - desc: "Spawn a random image with one or more characters wearing baggy clothes." - args: - - "" -Dress: - desc: "Spawn a random image with one or more characters wearing a dress" - args: - - "" -Tree: - desc: "Spawn a random image where one or more characters are in a tree." - args: - - "" -Screenshot: - desc: "Spawn image of a screenshot of the original source of the image. (ex. Screenshot of an anime scene)" - args: - - "" diff --git a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/res.yml b/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/res.yml deleted file mode 100644 index b05f47c09..000000000 --- a/src/Nadeko.Bot.Common/data/medusae/NorthShirahebi/res.yml +++ /dev/null @@ -1 +0,0 @@ -medusa.description: "Images and interactions module - For interacting with members and showing emotions." \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/data/medusae/medusa.yml b/src/Nadeko.Bot.Common/data/medusae/medusa.yml deleted file mode 100644 index feb66c83f..000000000 --- a/src/Nadeko.Bot.Common/data/medusae/medusa.yml +++ /dev/null @@ -1,5 +0,0 @@ -# DO NOT CHANGE -version: 1 -# List of medusae automatically loaded at startup -loaded: - - NorthShirahebi diff --git a/src/Nadeko.Bot.Db/Extensions/GuildConfigExtensions.cs b/src/Nadeko.Bot.Db/Extensions/GuildConfigExtensions.cs index 77a287106..a75c2bb20 100644 --- a/src/Nadeko.Bot.Db/Extensions/GuildConfigExtensions.cs +++ b/src/Nadeko.Bot.Db/Extensions/GuildConfigExtensions.cs @@ -54,7 +54,7 @@ public static class GuildConfigExtensions public static IEnumerable GetAllGuildConfigs( this DbSet configs, - List availableGuilds) + IReadOnlyList availableGuilds) => configs.IncludeEverything().AsNoTracking().Where(x => availableGuilds.Contains(x.GuildId)).ToList(); /// diff --git a/src/NadekoBot.Modules.Expresssions/ExportedExpr.cs b/src/Nadeko.Bot.Modules.Expresssions/ExportedExpr.cs similarity index 100% rename from src/NadekoBot.Modules.Expresssions/ExportedExpr.cs rename to src/Nadeko.Bot.Modules.Expresssions/ExportedExpr.cs diff --git a/src/NadekoBot.Modules.Expresssions/ExprField.cs b/src/Nadeko.Bot.Modules.Expresssions/ExprField.cs similarity index 100% rename from src/NadekoBot.Modules.Expresssions/ExprField.cs rename to src/Nadeko.Bot.Modules.Expresssions/ExprField.cs diff --git a/src/NadekoBot.Modules.Expresssions/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Expresssions/GlobalUsings.cs similarity index 75% rename from src/NadekoBot.Modules.Expresssions/GlobalUsings.cs rename to src/Nadeko.Bot.Modules.Expresssions/GlobalUsings.cs index 9f214124f..f23c88d19 100644 --- a/src/NadekoBot.Modules.Expresssions/GlobalUsings.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/GlobalUsings.cs @@ -23,9 +23,9 @@ global using Discord.WebSocket; // aliases global using GuildPerm = Discord.GuildPermission; global using ChannelPerm = Discord.ChannelPermission; -// global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; -// global using LeftoverAttribute = Discord.Commands.RemainderAttribute; -// global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; // non-essential // global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot.Modules.Expresssions/NadekoBot.Modules.Expresssions.csproj b/src/Nadeko.Bot.Modules.Expresssions/Nadeko.Bot.Modules.Expresssions.csproj similarity index 91% rename from src/NadekoBot.Modules.Expresssions/NadekoBot.Modules.Expresssions.csproj rename to src/Nadeko.Bot.Modules.Expresssions/Nadeko.Bot.Modules.Expresssions.csproj index 57e4863e2..4dd08788e 100644 --- a/src/NadekoBot.Modules.Expresssions/NadekoBot.Modules.Expresssions.csproj +++ b/src/Nadeko.Bot.Modules.Expresssions/Nadeko.Bot.Modules.Expresssions.csproj @@ -4,6 +4,7 @@ net7.0 enable enable + NadekoBot.Modules.Expresssions diff --git a/src/NadekoBot.Modules.Expresssions/NadekoExpressionExtensions.cs b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionExtensions.cs similarity index 100% rename from src/NadekoBot.Modules.Expresssions/NadekoExpressionExtensions.cs rename to src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionExtensions.cs diff --git a/src/NadekoBot.Modules.Expresssions/NadekoExpressions.cs b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressions.cs similarity index 99% rename from src/NadekoBot.Modules.Expresssions/NadekoExpressions.cs rename to src/Nadeko.Bot.Modules.Expresssions/NadekoExpressions.cs index b97aab3ff..daa88fab6 100644 --- a/src/NadekoBot.Modules.Expresssions/NadekoExpressions.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressions.cs @@ -1,5 +1,7 @@ #nullable disable +using NadekoBot.Common.Attributes; + namespace NadekoBot.Modules.NadekoExpressions; [Name("Expressions")] diff --git a/src/NadekoBot.Modules.Expresssions/NadekoExpressionsService.cs b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs similarity index 89% rename from src/NadekoBot.Modules.Expresssions/NadekoExpressionsService.cs rename to src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs index f420ff00b..03a31f29e 100644 --- a/src/NadekoBot.Modules.Expresssions/NadekoExpressionsService.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/NadekoExpressionsService.cs @@ -3,11 +3,10 @@ using Microsoft.EntityFrameworkCore; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Common.Yml; using NadekoBot.Db; -using NadekoBot.Modules.Permissions.Common; -using NadekoBot.Modules.Permissions.Services; using NadekoBot.Services.Database.Models; using System.Runtime.CompilerServices; using LinqToDB.EntityFrameworkCore; +using Nadeko.Bot.Common; using Nadeko.Common; using NadekoBot.Services; using Serilog; @@ -66,12 +65,13 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor private readonly DbService _db; private readonly DiscordSocketClient _client; - private readonly PermissionService _perms; - private readonly CommandHandler _cmd; + // private readonly PermissionService _perms; + // private readonly GlobalPermissionService _gperm; + // private readonly CmdCdService _cmdCds; + private readonly IPermissionChecker _permChecker; + private readonly ICommandHandler _cmd; private readonly IBotStrings _strings; - private readonly Bot _bot; - private readonly GlobalPermissionService _gperm; - private readonly CmdCdService _cmdCds; + private readonly IBot _bot; private readonly IPubSub _pubSub; private readonly IEmbedBuilderService _eb; private readonly Random _rng; @@ -80,27 +80,23 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor private ConcurrentHashSet _disabledGlobalExpressionGuilds; public NadekoExpressionsService( - PermissionService perms, DbService db, IBotStrings strings, - Bot bot, + IBot bot, DiscordSocketClient client, - CommandHandler cmd, - GlobalPermissionService gperm, - CmdCdService cmdCds, + ICommandHandler cmd, IPubSub pubSub, - IEmbedBuilderService eb) + IEmbedBuilderService eb, + IPermissionChecker permChecker) { _db = db; _client = client; - _perms = perms; _cmd = cmd; _strings = strings; _bot = bot; - _gperm = gperm; - _cmdCds = cmdCds; _pubSub = pubSub; _eb = eb; + _permChecker = permChecker; _rng = new NadekoRandom(); _pubSub.Sub(_exprsReloadedKey, OnExprsShouldReload); @@ -123,7 +119,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor .ToDictionary(g => g.Key, g => g.Select(x => { - x.Trigger = x.Trigger.Replace(MENTION_PH, _bot.Mention); + x.Trigger = x.Trigger.Replace(MENTION_PH, _client.CurrentUser.Mention); return x; }) .ToArray()) @@ -141,7 +137,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor .AsEnumerable() .Select(x => { - x.Trigger = x.Trigger.Replace(MENTION_PH, _bot.Mention); + x.Trigger = x.Trigger.Replace(MENTION_PH, _client.CurrentUser.Mention); return x; }) .ToArray(); @@ -243,46 +239,59 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor if (expr is null || expr.Response == "-") return false; - if (await _cmdCds.TryBlock(guild, msg.Author, expr.Trigger)) + var result = await _permChecker.CheckAsync( + guild, + msg.Channel, + msg.Author, + "ACTUALEXPRESSIONS", + expr.Trigger + ); + + if (!result.IsT0) return false; + // todo print error etc + + // if (await _cmdCds.TryBlock(guild, msg.Author, expr.Trigger)) + // return false; + try { - if (_gperm.BlockedModules.Contains("ACTUALEXPRESSIONS")) - { - Log.Information( - "User {UserName} [{UserId}] tried to use an expression but 'ActualExpressions' are globally disabled", - msg.Author.ToString(), - msg.Author.Id); - - return true; - } - - if (guild is SocketGuild sg) - { - var pc = _perms.GetCacheFor(guild.Id); - if (!pc.Permissions.CheckPermissions(msg, expr.Trigger, "ACTUALEXPRESSIONS", out var index)) - { - if (pc.Verbose) - { - var permissionMessage = _strings.GetText(strs.perm_prevent(index + 1, - Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), sg))), - sg.Id); - - try - { - await msg.Channel.SendErrorAsync(_eb, permissionMessage); - } - catch - { - } - - Log.Information("{PermissionMessage}", permissionMessage); - } - - return true; - } - } + // if (_gperm.BlockedModules.Contains("ACTUALEXPRESSIONS")) + // { + // Log.Information( + // "User {UserName} [{UserId}] tried to use an expression but 'ActualExpressions' are globally disabled", + // msg.Author.ToString(), + // msg.Author.Id); + // + // return true; + // } + // + // if (guild is SocketGuild sg) + // { + // var pc = _perms.GetCacheFor(guild.Id); + // if (!pc.Permissions.CheckPermissions(msg, expr.Trigger, "ACTUALEXPRESSIONS", out var index)) + // { + // if (pc.Verbose) + // { + // var permissionMessage = _strings.GetText(strs.perm_prevent(index + 1, + // Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), sg))), + // sg.Id); + // + // try + // { + // await msg.Channel.SendErrorAsync(_eb, permissionMessage); + // } + // catch + // { + // } + // + // Log.Information("{PermissionMessage}", permissionMessage); + // } + // + // return true; + // } + // } var sentMsg = await expr.Send(msg, _client, false); @@ -582,8 +591,8 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor #region Event Handlers - public Task OnReadyAsync() - => ReloadInternal(_bot.GetCurrentGuildIds()); + public async Task OnReadyAsync() + => await OnExprsShouldReload(true); private ValueTask OnExprsShouldReload(bool _) => new(ReloadInternal(_bot.GetCurrentGuildIds())); diff --git a/src/NadekoBot.Modules.Expresssions/TypeReaders/CommandOrExprTypeReader.cs b/src/Nadeko.Bot.Modules.Expresssions/TypeReaders/CommandOrExprTypeReader.cs similarity index 86% rename from src/NadekoBot.Modules.Expresssions/TypeReaders/CommandOrExprTypeReader.cs rename to src/Nadeko.Bot.Modules.Expresssions/TypeReaders/CommandOrExprTypeReader.cs index b22e265a2..16cac6a72 100644 --- a/src/NadekoBot.Modules.Expresssions/TypeReaders/CommandOrExprTypeReader.cs +++ b/src/Nadeko.Bot.Modules.Expresssions/TypeReaders/CommandOrExprTypeReader.cs @@ -1,13 +1,16 @@ #nullable disable +using NadekoBot.Modules.NadekoExpressions; +using NadekoBot.Services; + namespace NadekoBot.Common.TypeReaders; public sealed class CommandOrExprTypeReader : NadekoTypeReader { private readonly CommandService _cmds; - private readonly CommandHandler _commandHandler; + private readonly ICommandHandler _commandHandler; private readonly NadekoExpressionsService _exprs; - public CommandOrExprTypeReader(CommandService cmds, NadekoExpressionsService exprs, CommandHandler commandHandler) + public CommandOrExprTypeReader(CommandService cmds, NadekoExpressionsService exprs, ICommandHandler commandHandler) { _cmds = cmds; _exprs = exprs; diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRace.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRace.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRace.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRace.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRaceService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRaceService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRaceService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRaceService.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingUser.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingUser.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingUser.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/AnimalRacingUser.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/AlreadyJoinedException.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/AlreadyJoinedException.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/AlreadyJoinedException.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/AlreadyJoinedException.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/AlreadyStartedException.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/AlreadyStartedException.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/AlreadyStartedException.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/AlreadyStartedException.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/AnimalRaceFullException.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/AnimalRaceFullException.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/AnimalRaceFullException.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/AnimalRaceFullException.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/NotEnoughFundsException.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/NotEnoughFundsException.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/Exceptions/NotEnoughFundsException.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/Exceptions/NotEnoughFundsException.cs diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/RaceOptions.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/RaceOptions.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/AnimalRacing/RaceOptions.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/AnimalRacing/RaceOptions.cs diff --git a/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/Bank/BankService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Bank/BankService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/BankService.cs diff --git a/src/NadekoBot/Modules/Gambling/Bank/IBankService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/IBankService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Bank/IBankService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Bank/IBankService.cs diff --git a/src/NadekoBot/Modules/Gambling/BlackJack/BlackJackCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/BlackJack/BlackJackCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/BlackJack/BlackJackService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/BlackJack/BlackJackService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/BlackJackService.cs diff --git a/src/NadekoBot/Modules/Gambling/BlackJack/Blackjack.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/Blackjack.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/BlackJack/Blackjack.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/Blackjack.cs diff --git a/src/NadekoBot/Modules/Gambling/BlackJack/Player.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/Player.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/BlackJack/Player.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/BlackJack/Player.cs diff --git a/src/NadekoBot/Modules/Gambling/Connect4/Connect4.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Connect4/Connect4.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Connect4/Connect4.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Connect4/Connect4.cs diff --git a/src/NadekoBot/Modules/Gambling/Connect4/Connect4Commands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Connect4/Connect4Commands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Connect4/Connect4Commands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Connect4/Connect4Commands.cs diff --git a/src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/DiceRoll/DiceRollCommands.cs similarity index 99% rename from src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/DiceRoll/DiceRollCommands.cs index c49fe3930..76e0ed284 100644 --- a/src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/DiceRoll/DiceRollCommands.cs @@ -19,7 +19,7 @@ public partial class Gambling private static readonly char[] _fateRolls = { '-', ' ', '+' }; private readonly IImageCache _images; - public DiceRollCommands(ImageCache images) + public DiceRollCommands(IImageCache images) => _images = images; [Cmd] diff --git a/src/NadekoBot/Modules/Gambling/Draw/DrawCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Draw/DrawCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Draw/DrawCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Draw/DrawCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/EconomyResult.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/EconomyResult.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/EconomyResult.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/EconomyResult.cs diff --git a/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/CurrencyEventsCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Events/CurrencyEventsCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Events/CurrencyEventsCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/CurrencyEventsService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Events/CurrencyEventsService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Events/CurrencyEventsService.cs diff --git a/src/NadekoBot/Modules/Gambling/Events/EventOptions.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/EventOptions.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Events/EventOptions.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Events/EventOptions.cs diff --git a/src/NadekoBot/Modules/Gambling/Events/GameStatusEvent.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/GameStatusEvent.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Events/GameStatusEvent.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Events/GameStatusEvent.cs diff --git a/src/NadekoBot/Modules/Gambling/Events/ICurrencyEvent.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/ICurrencyEvent.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Events/ICurrencyEvent.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Events/ICurrencyEvent.cs diff --git a/src/NadekoBot/Modules/Gambling/Events/ReactionEvent.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Events/ReactionEvent.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Events/ReactionEvent.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Events/ReactionEvent.cs diff --git a/src/NadekoBot/Modules/Gambling/FlipCoin/FlipCoinCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipCoinCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/FlipCoin/FlipCoinCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipCoinCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/FlipCoin/FlipResult.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipResult.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/FlipCoin/FlipResult.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/FlipCoin/FlipResult.cs diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Gambling.cs similarity index 99% rename from src/NadekoBot/Modules/Gambling/Gambling.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Gambling.cs index 28bd148b8..136ab7f36 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Gambling.cs @@ -29,7 +29,7 @@ public partial class Gambling : GamblingModule private readonly GamblingConfigService _configService; private readonly IBankService _bank; private readonly IPatronageService _ps; - private readonly RemindService _remind; + private readonly IRemindService _remind; private readonly GamblingTxTracker _gamblingTxTracker; private IUserMessage rdMsg; @@ -43,7 +43,7 @@ public partial class Gambling : GamblingModule GamblingConfigService configService, IBankService bank, IPatronageService ps, - RemindService remind, + IRemindService remind, GamblingTxTracker gamblingTxTracker) : base(configService) { diff --git a/src/NadekoBot/Modules/Gambling/GamblingConfig.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfig.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/GamblingConfig.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfig.cs diff --git a/src/NadekoBot/Modules/Gambling/GamblingConfigService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs similarity index 99% rename from src/NadekoBot/Modules/Gambling/GamblingConfigService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs index 3f4bbefe6..d67072c6e 100644 --- a/src/NadekoBot/Modules/Gambling/GamblingConfigService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingConfigService.cs @@ -1,6 +1,8 @@ #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/NadekoBot/Modules/Gambling/GamblingService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs similarity index 98% rename from src/NadekoBot/Modules/Gambling/GamblingService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs index d64761afa..1ba66d96e 100644 --- a/src/NadekoBot/Modules/Gambling/GamblingService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingService.cs @@ -15,7 +15,7 @@ public class GamblingService : INService, IReadyExecutor public ConcurrentDictionary Connect4Games { get; } = new(); private readonly DbService _db; private readonly ICurrencyService _cs; - private readonly Bot _bot; + private readonly IBot _bot; private readonly DiscordSocketClient _client; private readonly IBotCache _cache; private readonly GamblingConfigService _gss; @@ -24,7 +24,6 @@ public class GamblingService : INService, IReadyExecutor public GamblingService( DbService db, - Bot bot, ICurrencyService cs, DiscordSocketClient client, IBotCache cache, @@ -32,7 +31,6 @@ public class GamblingService : INService, IReadyExecutor { _db = db; _cs = cs; - _bot = bot; _client = client; _cache = cache; _gss = gss; @@ -43,7 +41,7 @@ public class GamblingService : INService, IReadyExecutor private async Task TransactionClearLoopAsync() { - if (_bot.Client.ShardId != 0) + if (_client.ShardId != 0) return; using var timer = new PeriodicTimer(TimeSpan.FromHours(1)); @@ -72,7 +70,7 @@ public class GamblingService : INService, IReadyExecutor private async Task CurrencyDecayLoopAsync() { - if (_bot.Client.ShardId != 0) + if (_client.ShardId != 0) return; using var timer = new PeriodicTimer(TimeSpan.FromMinutes(5)); diff --git a/src/NadekoBot/Modules/Gambling/GamblingTopLevelModule.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs similarity index 98% rename from src/NadekoBot/Modules/Gambling/GamblingTopLevelModule.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs index c1a53e779..2fe50e876 100644 --- a/src/NadekoBot/Modules/Gambling/GamblingTopLevelModule.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs @@ -2,6 +2,8 @@ using NadekoBot.Modules.Gambling.Services; using System.Globalization; using System.Numerics; +using Discord; +using NadekoBot.Common; namespace NadekoBot.Modules.Gambling.Common; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GlobalUsings.cs new file mode 100644 index 000000000..f36328bd4 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GlobalUsings.cs @@ -0,0 +1,31 @@ +// global using System.Collections.Concurrent; +global using NonBlocking; + +// packages +global using Serilog; +global using Humanizer; + +// nadekobot +global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot/Modules/Gambling/InputRpsPick.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/InputRpsPick.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/InputRpsPick.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/InputRpsPick.cs diff --git a/src/NadekoBot/Modules/Gambling/PlantPick/PlantAndPickCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantAndPickCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/PlantPick/PlantAndPickCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantAndPickCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/PlantPick/PlantPickService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantPickService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/PlantPick/PlantPickService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/PlantPick/PlantPickService.cs diff --git a/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleGame.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleGame.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleGame.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleGame.cs diff --git a/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Raffle/CurrencyRaffleService.cs diff --git a/src/NadekoBot/Modules/Gambling/Shop/IShopService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/IShopService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Shop/IShopService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/IShopService.cs diff --git a/src/NadekoBot/Modules/Gambling/Shop/ShopCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Shop/ShopCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/Shop/ShopService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Shop/ShopService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Shop/ShopService.cs diff --git a/src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs similarity index 99% rename from src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs index f0a6db472..2599f0d1b 100644 --- a/src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/Slot/SlotCommands.cs @@ -34,7 +34,7 @@ public partial class Gambling private object _slotStatsLock = new(); public SlotCommands( - ImageCache images, + IImageCache images, FontProvider fonts, DbService db, GamblingConfigService gamb) diff --git a/src/NadekoBot/Modules/Gambling/VoteRewardService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs similarity index 98% rename from src/NadekoBot/Modules/Gambling/VoteRewardService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs index 1a92cefdb..fc656b1e6 100644 --- a/src/NadekoBot/Modules/Gambling/VoteRewardService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/VoteRewardService.cs @@ -2,6 +2,9 @@ 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/NadekoBot/Modules/Gambling/Waifus/Common/AffinityTitle.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/AffinityTitle.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/Common/AffinityTitle.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/AffinityTitle.cs diff --git a/src/NadekoBot/Modules/Gambling/Waifus/Common/ClaimTitle.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/ClaimTitle.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/Common/ClaimTitle.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/ClaimTitle.cs diff --git a/src/NadekoBot/Modules/Gambling/Waifus/Common/DivorceResult.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/DivorceResult.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/Common/DivorceResult.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/DivorceResult.cs diff --git a/src/NadekoBot/Modules/Gambling/Waifus/Common/Extensions.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/Extensions.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/Common/Extensions.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/Extensions.cs diff --git a/src/NadekoBot/Modules/Gambling/Waifus/Common/WaifuClaimResult.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/WaifuClaimResult.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/Common/WaifuClaimResult.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/Common/WaifuClaimResult.cs diff --git a/src/NadekoBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuClaimCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuClaimCommands.cs diff --git a/src/NadekoBot/Modules/Gambling/Waifus/WaifuService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/Waifus/WaifuService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/Waifus/WaifuService.cs diff --git a/src/NadekoBot/Modules/Gambling/~Shared/Decks/QuadDeck.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/Decks/QuadDeck.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/~Shared/Decks/QuadDeck.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/Decks/QuadDeck.cs diff --git a/src/NadekoBot/Modules/Gambling/~Shared/IGamblingService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/IGamblingService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/~Shared/IGamblingService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/IGamblingService.cs diff --git a/src/NadekoBot/Modules/Gambling/~Shared/NewGamblingService.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/NewGamblingService.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/~Shared/NewGamblingService.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/NewGamblingService.cs diff --git a/src/NadekoBot/Modules/Gambling/~Shared/RollDuelGame.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/RollDuelGame.cs similarity index 100% rename from src/NadekoBot/Modules/Gambling/~Shared/RollDuelGame.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/RollDuelGame.cs diff --git a/src/NadekoBot/Common/TypeReaders/Shmart/BaseShmartInputAmountReader.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/TypeReaders/BaseShmartInputAmountReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/Shmart/BaseShmartInputAmountReader.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/TypeReaders/BaseShmartInputAmountReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/Shmart/ShmartBankInputAmountReader.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/TypeReaders/ShmartBankInputAmountReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/Shmart/ShmartBankInputAmountReader.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/TypeReaders/ShmartBankInputAmountReader.cs diff --git a/src/NadekoBot/Common/TypeReaders/Shmart/ShmartNumberTypeReader.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/TypeReaders/ShmartNumberTypeReader.cs similarity index 100% rename from src/NadekoBot/Common/TypeReaders/Shmart/ShmartNumberTypeReader.cs rename to src/Nadeko.Bot.Modules.Gambling/Gambling/_Common/TypeReaders/ShmartNumberTypeReader.cs diff --git a/src/NadekoBot/Modules/Games/Acrophobia/Acrophobia.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Acrophobia/Acrophobia.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Acrophobia/Acrophobia.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Acrophobia/Acrophobia.cs diff --git a/src/NadekoBot/Modules/Games/Acrophobia/AcrophobiaUser.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Acrophobia/AcrophobiaUser.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Acrophobia/AcrophobiaUser.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Acrophobia/AcrophobiaUser.cs diff --git a/src/NadekoBot/Modules/Games/Acrophobia/AcropobiaCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Acrophobia/AcropobiaCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Acrophobia/AcropobiaCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Acrophobia/AcropobiaCommands.cs diff --git a/src/NadekoBot/Modules/Games/ChatterBot/ChatterbotService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/ChatterbotService.cs similarity index 86% rename from src/NadekoBot/Modules/Games/ChatterBot/ChatterbotService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/ChatterbotService.cs index 7900f34f1..e5e11e0a8 100644 --- a/src/NadekoBot/Modules/Games/ChatterBot/ChatterbotService.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/ChatterbotService.cs @@ -1,11 +1,10 @@ #nullable disable +using Nadeko.Bot.Common; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Db.Models; using NadekoBot.Modules.Games.Common; using NadekoBot.Modules.Games.Common.ChatterBot; using NadekoBot.Modules.Permissions; -using NadekoBot.Modules.Permissions.Common; -using NadekoBot.Modules.Permissions.Services; using NadekoBot.Modules.Utility.Patronage; namespace NadekoBot.Modules.Games.Services; @@ -20,27 +19,25 @@ public class ChatterBotService : IExecOnMessage private readonly FeatureLimitKey _flKey; private readonly DiscordSocketClient _client; - private readonly PermissionService _perms; + private readonly IPermissionChecker _perms; private readonly CommandHandler _cmd; private readonly IBotStrings _strings; private readonly IBotCredentials _creds; private readonly IEmbedBuilderService _eb; private readonly IHttpClientFactory _httpFactory; private readonly IPatronageService _ps; - private readonly CmdCdService _ccs; private readonly GamesConfigService _gcs; public ChatterBotService( DiscordSocketClient client, - PermissionService perms, - Bot bot, + IPermissionChecker perms, + IBot bot, CommandHandler cmd, IBotStrings strings, IHttpClientFactory factory, IBotCredentials creds, IEmbedBuilderService eb, IPatronageService ps, - CmdCdService cmdCdService, GamesConfigService gcs) { _client = client; @@ -51,7 +48,7 @@ public class ChatterBotService : IExecOnMessage _eb = eb; _httpFactory = factory; _ps = ps; - _ccs = cmdCdService; + _perms = perms; _gcs = gcs; _flKey = new FeatureLimitKey() @@ -128,30 +125,17 @@ public class ChatterBotService : IExecOnMessage if (message is null || cbs is null) return false; - var pc = _perms.GetCacheFor(guild.Id); - if (!pc.Permissions.CheckPermissions(usrMsg, - "cleverbot", - "games", - out var index)) - { - if (pc.Verbose) - { - var returnMsg = _strings.GetText(strs.perm_prevent(index + 1, - Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(sg), sg)))); - - try { await usrMsg.Channel.SendErrorAsync(_eb, returnMsg); } - catch { } - - Log.Information("{PermissionMessage}", returnMsg); - } - - return false; - } - - if (await _ccs.TryBlock(sg, usrMsg.Author, CleverBotResponseStr.CLEVERBOT_RESPONSE)) - { + var res = await _perms.CheckAsync(sg, + usrMsg.Channel, + usrMsg.Author, + "games", + CleverBotResponseStr.CLEVERBOT_RESPONSE); + + // todo this needs checking, this might block all messages in a channel if cleverbot is enabled but blocked + // need to check what kind of block it is + // might be the case for other classes using permission checker + if (!res.IsT0) return true; - } var channel = (ITextChannel)usrMsg.Channel; var conf = _ps.GetConfig(); diff --git a/src/NadekoBot/Modules/Games/ChatterBot/CleverBotCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/CleverBotCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/ChatterBot/CleverBotCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/CleverBotCommands.cs diff --git a/src/NadekoBot/Modules/Games/ChatterBot/_Common/CleverbotResponse.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/CleverbotResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Games/ChatterBot/_Common/CleverbotResponse.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/CleverbotResponse.cs diff --git a/src/NadekoBot/Modules/Games/ChatterBot/_Common/Gpt3Response.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/Gpt3Response.cs similarity index 100% rename from src/NadekoBot/Modules/Games/ChatterBot/_Common/Gpt3Response.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/Gpt3Response.cs diff --git a/src/NadekoBot/Modules/Games/ChatterBot/_Common/IChatterBotSession.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/IChatterBotSession.cs similarity index 100% rename from src/NadekoBot/Modules/Games/ChatterBot/_Common/IChatterBotSession.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/IChatterBotSession.cs diff --git a/src/NadekoBot/Modules/Games/ChatterBot/_Common/OfficialCleverbotSession.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/OfficialCleverbotSession.cs similarity index 100% rename from src/NadekoBot/Modules/Games/ChatterBot/_Common/OfficialCleverbotSession.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/OfficialCleverbotSession.cs diff --git a/src/NadekoBot/Modules/Games/ChatterBot/_Common/OfficialGpt3Session.cs b/src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/OfficialGpt3Session.cs similarity index 100% rename from src/NadekoBot/Modules/Games/ChatterBot/_Common/OfficialGpt3Session.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/ChatterBot/_Common/OfficialGpt3Session.cs diff --git a/src/NadekoBot/Modules/Games/Games.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Games.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Games.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Games.cs diff --git a/src/NadekoBot/Modules/Games/GamesConfig.cs b/src/Nadeko.Bot.Modules.Gambling/Games/GamesConfig.cs similarity index 100% rename from src/NadekoBot/Modules/Games/GamesConfig.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/GamesConfig.cs diff --git a/src/NadekoBot/Modules/Games/GamesConfigService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/GamesConfigService.cs similarity index 100% rename from src/NadekoBot/Modules/Games/GamesConfigService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/GamesConfigService.cs diff --git a/src/NadekoBot/Modules/Games/GamesService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/GamesService.cs similarity index 100% rename from src/NadekoBot/Modules/Games/GamesService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/GamesService.cs diff --git a/src/NadekoBot/Modules/Games/GirlRating.cs b/src/Nadeko.Bot.Modules.Gambling/Games/GirlRating.cs similarity index 100% rename from src/NadekoBot/Modules/Games/GirlRating.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/GirlRating.cs diff --git a/src/NadekoBot/Modules/Games/Hangman/DefaultHangmanSource.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/DefaultHangmanSource.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Hangman/DefaultHangmanSource.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/DefaultHangmanSource.cs diff --git a/src/NadekoBot/Modules/Games/Hangman/HangmanCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Hangman/HangmanCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanCommands.cs diff --git a/src/NadekoBot/Modules/Games/Hangman/HangmanGame.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanGame.cs similarity index 92% rename from src/NadekoBot/Modules/Games/Hangman/HangmanGame.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanGame.cs index e878687fd..82b86bcd4 100644 --- a/src/NadekoBot/Modules/Games/Hangman/HangmanGame.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanGame.cs @@ -1,5 +1,4 @@ #nullable disable -using AngleSharp.Text; namespace NadekoBot.Modules.Games.Hangman; @@ -23,7 +22,7 @@ public sealed class HangmanGame _word = term.Word; _imageUrl = term.ImageUrl; - _remaining = _word.ToLowerInvariant().Where(x => x.IsLetter()).Select(char.ToLowerInvariant).ToHashSet(); + _remaining = _word.ToLowerInvariant().Where(x => char.IsLetter(x)).Select(char.ToLowerInvariant).ToHashSet(); } public State GetState(GuessResult guessResult = GuessResult.NoAction) @@ -42,7 +41,7 @@ public sealed class HangmanGame var ch = _word[i]; if (ch == ' ') output[i * 2] = ' '; - if (!ch.IsLetter() || !_remaining.Contains(char.ToLowerInvariant(ch))) + if (!char.IsLetter(ch) || !_remaining.Contains(char.ToLowerInvariant(ch))) output[i * 2] = ch; else output[i * 2] = '_'; diff --git a/src/NadekoBot/Modules/Games/Hangman/HangmanService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanService.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Hangman/HangmanService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanService.cs diff --git a/src/NadekoBot/Modules/Games/Hangman/HangmanTerm.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanTerm.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Hangman/HangmanTerm.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/HangmanTerm.cs diff --git a/src/NadekoBot/Modules/Games/Hangman/IHangmanService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/IHangmanService.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Hangman/IHangmanService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/IHangmanService.cs diff --git a/src/NadekoBot/Modules/Games/Hangman/IHangmanSource.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Hangman/IHangmanSource.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Hangman/IHangmanSource.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Hangman/IHangmanSource.cs diff --git a/src/NadekoBot/Modules/Games/Nunchi/Nunchi.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Nunchi/Nunchi.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Nunchi/Nunchi.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Nunchi/Nunchi.cs diff --git a/src/NadekoBot/Modules/Games/Nunchi/NunchiCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Nunchi/NunchiCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Nunchi/NunchiCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Nunchi/NunchiCommands.cs diff --git a/src/NadekoBot/Modules/Games/Polls/PollCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Polls/PollCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Polls/PollCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Polls/PollCommands.cs diff --git a/src/NadekoBot/Modules/Games/Polls/PollRunner.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Polls/PollRunner.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Polls/PollRunner.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Polls/PollRunner.cs diff --git a/src/NadekoBot/Modules/Games/Polls/PollService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Polls/PollService.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Polls/PollService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Polls/PollService.cs diff --git a/src/NadekoBot/Modules/Games/SpeedTyping/SpeedTypingCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/SpeedTyping/SpeedTypingCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/SpeedTyping/SpeedTypingCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/SpeedTyping/SpeedTypingCommands.cs diff --git a/src/NadekoBot/Modules/Games/SpeedTyping/TypingArticle.cs b/src/Nadeko.Bot.Modules.Gambling/Games/SpeedTyping/TypingArticle.cs similarity index 100% rename from src/NadekoBot/Modules/Games/SpeedTyping/TypingArticle.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/SpeedTyping/TypingArticle.cs diff --git a/src/NadekoBot/Modules/Games/SpeedTyping/TypingGame.cs b/src/Nadeko.Bot.Modules.Gambling/Games/SpeedTyping/TypingGame.cs similarity index 100% rename from src/NadekoBot/Modules/Games/SpeedTyping/TypingGame.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/SpeedTyping/TypingGame.cs diff --git a/src/NadekoBot/Modules/Games/TicTacToe/TicTacToe.cs b/src/Nadeko.Bot.Modules.Gambling/Games/TicTacToe/TicTacToe.cs similarity index 100% rename from src/NadekoBot/Modules/Games/TicTacToe/TicTacToe.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/TicTacToe/TicTacToe.cs diff --git a/src/NadekoBot/Modules/Games/TicTacToe/TicTacToeCommands.cs b/src/Nadeko.Bot.Modules.Gambling/Games/TicTacToe/TicTacToeCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Games/TicTacToe/TicTacToeCommands.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/TicTacToe/TicTacToeCommands.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/Games.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/Games.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/Games.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/Games.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/QuestionPool/DefaultQuestionPool.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/QuestionPool/DefaultQuestionPool.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/QuestionPool/DefaultQuestionPool.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/QuestionPool/DefaultQuestionPool.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/QuestionPool/IQuestionPool.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/QuestionPool/IQuestionPool.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/QuestionPool/IQuestionPool.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/QuestionPool/IQuestionPool.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/QuestionPool/PokemonQuestionPool.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/QuestionPool/PokemonQuestionPool.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/QuestionPool/PokemonQuestionPool.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/QuestionPool/PokemonQuestionPool.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/TriviaGame.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaGame.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/TriviaGame.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaGame.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/TriviaGamesService.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaGamesService.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/TriviaGamesService.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaGamesService.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/TriviaOptions.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaOptions.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/TriviaOptions.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaOptions.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/TriviaQuestion.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaQuestion.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/TriviaQuestion.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaQuestion.cs diff --git a/src/NadekoBot/Modules/Games/Trivia/TriviaUser.cs b/src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaUser.cs similarity index 100% rename from src/NadekoBot/Modules/Games/Trivia/TriviaUser.cs rename to src/Nadeko.Bot.Modules.Gambling/Games/Trivia/TriviaUser.cs diff --git a/src/Nadeko.Bot.Modules.Gambling/Nadeko.Bot.Modules.Gambling.csproj b/src/Nadeko.Bot.Modules.Gambling/Nadeko.Bot.Modules.Gambling.csproj new file mode 100644 index 000000000..1a78c0607 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Gambling/Nadeko.Bot.Modules.Gambling.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + diff --git a/src/NadekoBot/Bot.cs b/src/NadekoBot/Bot.cs index f15216809..21b6072ab 100644 --- a/src/NadekoBot/Bot.cs +++ b/src/NadekoBot/Bot.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using NadekoBot.Common.Configs; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Db; +using NadekoBot.Modules.NadekoExpressions; using NadekoBot.Modules.Utility; using NadekoBot.Services.Database.Models; using Ninject; @@ -15,15 +16,16 @@ using RunMode = Discord.Commands.RunMode; namespace NadekoBot; -public sealed class Bot +public sealed class Bot : IBot { public event Func JoinedGuild = delegate { return Task.CompletedTask; }; public DiscordSocketClient Client { get; } - public ImmutableArray AllGuildConfigs { get; private set; } + public IReadOnlyCollection AllGuildConfigs { get; private set; } private IKernel Services { get; set; } + // todo remove public string Mention { get; private set; } public bool IsReady { get; private set; } public int ShardId { get; set; } @@ -33,6 +35,8 @@ public sealed class Bot private readonly DbService _db; private readonly IBotCredsProvider _credsProvider; + + private readonly Assembly[] _moduleAssemblies; // private readonly InteractionService _interactionService; public Bot(int shardId, int? totalShards, string credPath = null) @@ -83,10 +87,18 @@ public sealed class Bot // _interactionService = new(Client.Rest); Client.Log += Client_Log; + _moduleAssemblies = new[] + { + typeof(Bot).Assembly, // bot + typeof(Creds).Assembly, // bot.common + + // modules + typeof(NadekoExpressions).Assembly, + }; } - public List GetCurrentGuildIds() + public IReadOnlyList GetCurrentGuildIds() => Client.Guilds.Select(x => x.Id).ToList(); private void AddServices() @@ -117,14 +129,21 @@ public sealed class Bot 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(); - kernel.AddConfigServices() - .AddConfigMigrators() - .AddMusic() + + foreach (var a in _moduleAssemblies) + { + kernel.AddConfigServices(a) + .AddConfigMigrators(a) + .AddLifetimeServices(a); + } + + kernel.AddMusic() .AddCache(_creds) .AddHttpClients(); @@ -137,8 +156,6 @@ public sealed class Bot kernel.Bind().To().InSingletonScope(); } - kernel.AddLifetimeServices(); - kernel.Bind().ToConstant(kernel).InSingletonScope(); //initialize Services @@ -149,7 +166,10 @@ public sealed class Bot if (Client.ShardId == 0) ApplyConfigMigrations(); - LoadTypeReaders(typeof(Bot).Assembly); + foreach (var a in _moduleAssemblies) + { + LoadTypeReaders(a); + } sw.Stop(); Log.Information("All services loaded in {ServiceLoadTime:F2}s", sw.Elapsed.TotalSeconds); @@ -166,16 +186,16 @@ public sealed class Bot private void LoadTypeReaders(Assembly assembly) { var filteredTypes = assembly.GetTypes() - .Where(x => x.IsSubclassOf(typeof(TypeReader)) - && x.BaseType?.GetGenericArguments().Length > 0 - && !x.IsAbstract); - + .Where(x => x.IsSubclassOf(typeof(TypeReader)) + && x.BaseType?.GetGenericArguments().Length > 0 + && !x.IsAbstract); + foreach (var ft in filteredTypes) { var baseType = ft.BaseType; if (baseType is null) continue; - + var typeReader = (TypeReader)ActivatorUtilities.CreateInstance(Services, ft); var typeArgs = baseType.GetGenericArguments(); _commandService.AddTypeReader(typeArgs[0], typeReader); @@ -280,7 +300,11 @@ public sealed class Bot // start handling messages received in commandhandler await commandHandler.StartHandling(); - await _commandService.AddModulesAsync(typeof(Bot).Assembly, Services); + foreach (var a in _moduleAssemblies) + { + await _commandService.AddModulesAsync(a, Services); + } + // await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services); IsReady = true; diff --git a/src/NadekoBot/Common/ServiceCollectionExtensions.cs b/src/NadekoBot/Common/ServiceCollectionExtensions.cs index 84c1bccfd..e4ebfaa28 100644 --- a/src/NadekoBot/Common/ServiceCollectionExtensions.cs +++ b/src/NadekoBot/Common/ServiceCollectionExtensions.cs @@ -34,11 +34,11 @@ public static class ServiceCollectionExtensions return kernel; } - public static IKernel AddConfigServices(this IKernel kernel) + public static IKernel AddConfigServices(this IKernel kernel, Assembly a) { kernel.Bind(x => { - var configs = x.FromThisAssembly() + var configs = x.From(a) .SelectAllClasses() .Where(f => f.IsAssignableToGenericType(typeof(ConfigServiceBase<>))); @@ -49,8 +49,8 @@ public static class ServiceCollectionExtensions return kernel; } - public static IKernel AddConfigMigrators(this IKernel kernel) - => kernel.AddSealedSubclassesOf(typeof(IConfigMigrator)); + public static IKernel AddConfigMigrators(this IKernel kernel, Assembly a) + => kernel.AddSealedSubclassesOf(typeof(IConfigMigrator), a); public static IKernel AddMusic(this IKernel kernel) { @@ -69,11 +69,11 @@ public static class ServiceCollectionExtensions return kernel; } - public static IKernel AddSealedSubclassesOf(this IKernel kernel, Type baseType) + public static IKernel AddSealedSubclassesOf(this IKernel kernel, Type baseType, Assembly a) { kernel.Bind(x => { - var classes = x.FromThisAssembly() + var classes = x.From(a) .SelectAllClasses() .Where(c => c.IsPublic && c.IsNested && baseType.IsAssignableFrom(baseType)); @@ -128,11 +128,11 @@ public static class ServiceCollectionExtensions public static IConfigureSyntax BindToSelfWithInterfaces(this IJoinExcludeIncludeBindSyntax matcher) => matcher.BindSelection((type, types) => types.Append(type)); - public static IKernel AddLifetimeServices(this IKernel kernel) + public static IKernel AddLifetimeServices(this IKernel kernel, Assembly a) { kernel.Bind(scan => { - scan.FromThisAssembly() + scan.From(a) .SelectAllClasses() .Where(c => (c.IsAssignableTo(typeof(INService)) || c.IsAssignableTo(typeof(IExecOnMessage)) diff --git a/src/NadekoBot/Common/Medusa/Adapters/BehaviorAdapter.cs b/src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs similarity index 96% rename from src/NadekoBot/Common/Medusa/Adapters/BehaviorAdapter.cs rename to src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs index 2e369824a..e08711757 100644 --- a/src/NadekoBot/Common/Medusa/Adapters/BehaviorAdapter.cs +++ b/src/NadekoBot/Medusa/Adapters/BehaviorAdapter.cs @@ -1,5 +1,9 @@ #nullable enable +using Nadeko.Snake; +using NadekoBot.Common; +using NadekoBot.Services; + [DIIgnore] public sealed class BehaviorAdapter : ICustomBehavior { diff --git a/src/NadekoBot/Common/Medusa/Adapters/ContextAdapterFactory.cs b/src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs similarity index 82% rename from src/NadekoBot/Common/Medusa/Adapters/ContextAdapterFactory.cs rename to src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs index 3f3be033c..5251a2f29 100644 --- a/src/NadekoBot/Common/Medusa/Adapters/ContextAdapterFactory.cs +++ b/src/NadekoBot/Medusa/Adapters/ContextAdapterFactory.cs @@ -1,4 +1,6 @@ -internal class ContextAdapterFactory +using Nadeko.Snake; + +internal class ContextAdapterFactory { public static AnyContext CreateNew(ICommandContext context, IMedusaStrings strings, IServiceProvider services) => context.Guild is null diff --git a/src/NadekoBot/Common/Medusa/Adapters/DmContextAdapter.cs b/src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs similarity index 95% rename from src/NadekoBot/Common/Medusa/Adapters/DmContextAdapter.cs rename to src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs index 80cb115b0..aae890916 100644 --- a/src/NadekoBot/Common/Medusa/Adapters/DmContextAdapter.cs +++ b/src/NadekoBot/Medusa/Adapters/DmContextAdapter.cs @@ -1,4 +1,8 @@ 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/Common/Medusa/Adapters/FilterAdapter.cs b/src/NadekoBot/Medusa/Adapters/FilterAdapter.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Adapters/FilterAdapter.cs rename to src/NadekoBot/Medusa/Adapters/FilterAdapter.cs diff --git a/src/NadekoBot/Common/Medusa/Adapters/GuildContextAdapter.cs b/src/NadekoBot/Medusa/Adapters/GuildContextAdapter.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Adapters/GuildContextAdapter.cs rename to src/NadekoBot/Medusa/Adapters/GuildContextAdapter.cs diff --git a/src/NadekoBot/Common/Medusa/Adapters/ParamParserAdapter.cs b/src/NadekoBot/Medusa/Adapters/ParamParserAdapter.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Adapters/ParamParserAdapter.cs rename to src/NadekoBot/Medusa/Adapters/ParamParserAdapter.cs diff --git a/src/NadekoBot/Common/Medusa/CommandContextType.cs b/src/NadekoBot/Medusa/CommandContextType.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/CommandContextType.cs rename to src/NadekoBot/Medusa/CommandContextType.cs diff --git a/src/NadekoBot/Common/Medusa/Config/IMedusaConfigService.cs b/src/NadekoBot/Medusa/Config/IMedusaConfigService.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Config/IMedusaConfigService.cs rename to src/NadekoBot/Medusa/Config/IMedusaConfigService.cs diff --git a/src/NadekoBot/Common/Medusa/Config/MedusaConfig.cs b/src/NadekoBot/Medusa/Config/MedusaConfig.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Config/MedusaConfig.cs rename to src/NadekoBot/Medusa/Config/MedusaConfig.cs diff --git a/src/NadekoBot/Common/Medusa/Config/MedusaConfigService.cs b/src/NadekoBot/Medusa/Config/MedusaConfigService.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Config/MedusaConfigService.cs rename to src/NadekoBot/Medusa/Config/MedusaConfigService.cs diff --git a/src/NadekoBot/Common/Medusa/MedusaAssemblyLoadContext.cs b/src/NadekoBot/Medusa/MedusaAssemblyLoadContext.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/MedusaAssemblyLoadContext.cs rename to src/NadekoBot/Medusa/MedusaAssemblyLoadContext.cs diff --git a/src/NadekoBot/Common/Medusa/MedusaIoCKernelModule.cs b/src/NadekoBot/Medusa/MedusaIoCKernelModule.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/MedusaIoCKernelModule.cs rename to src/NadekoBot/Medusa/MedusaIoCKernelModule.cs diff --git a/src/NadekoBot/Common/Medusa/MedusaLoaderService.cs b/src/NadekoBot/Medusa/MedusaLoaderService.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/MedusaLoaderService.cs rename to src/NadekoBot/Medusa/MedusaLoaderService.cs diff --git a/src/NadekoBot/Common/Medusa/Models/ParamData.cs b/src/NadekoBot/Medusa/Models/ParamData.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Models/ParamData.cs rename to src/NadekoBot/Medusa/Models/ParamData.cs diff --git a/src/NadekoBot/Common/Medusa/Models/ResolvedMedusa.cs b/src/NadekoBot/Medusa/Models/ResolvedMedusa.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Models/ResolvedMedusa.cs rename to src/NadekoBot/Medusa/Models/ResolvedMedusa.cs diff --git a/src/NadekoBot/Common/Medusa/Models/SnekCommandData.cs b/src/NadekoBot/Medusa/Models/SnekCommandData.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Models/SnekCommandData.cs rename to src/NadekoBot/Medusa/Models/SnekCommandData.cs diff --git a/src/NadekoBot/Common/Medusa/Models/SnekData.cs b/src/NadekoBot/Medusa/Models/SnekData.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/Models/SnekData.cs rename to src/NadekoBot/Medusa/Models/SnekData.cs diff --git a/src/NadekoBot/Common/Medusa/RemovablePlanner.cs b/src/NadekoBot/Medusa/RemovablePlanner.cs similarity index 100% rename from src/NadekoBot/Common/Medusa/RemovablePlanner.cs rename to src/NadekoBot/Medusa/RemovablePlanner.cs diff --git a/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideService.cs b/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideService.cs index e8e7774e5..27bbe0aa1 100644 --- a/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideService.cs +++ b/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideService.cs @@ -6,7 +6,7 @@ using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Administration.Services; -public class DiscordPermOverrideService : INService, IExecPreCommand +public class DiscordPermOverrideService : INService, IExecPreCommand, IDiscordPermOverrideService { public int Priority { get; } = int.MaxValue; private readonly DbService _db; diff --git a/src/NadekoBot/Modules/Gambling/CurrencyProvider.cs b/src/NadekoBot/Modules/Gambling/CurrencyProvider.cs new file mode 100644 index 000000000..6b228a295 --- /dev/null +++ b/src/NadekoBot/Modules/Gambling/CurrencyProvider.cs @@ -0,0 +1,18 @@ +using Nadeko.Bot.Common; +using NadekoBot.Modules.Gambling.Services; + +namespace NadekoBot.Modules.Gambling; + +// todo do we need both currencyprovider and currencyservice +public sealed class CurrencyProvider : ICurrencyProvider +{ + private readonly GamblingConfigService _cs; + + public CurrencyProvider(GamblingConfigService cs) + { + _cs = cs; + } + + public string GetCurrencySign() + => _cs.Data.Currency.Sign; +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Permissions/PermissionExtensions.cs b/src/NadekoBot/Modules/Permissions/PermissionExtensions.cs index b01582561..e6f96ab17 100644 --- a/src/NadekoBot/Modules/Permissions/PermissionExtensions.cs +++ b/src/NadekoBot/Modules/Permissions/PermissionExtensions.cs @@ -7,7 +7,8 @@ public static class PermissionExtensions { public static bool CheckPermissions( this IEnumerable permsEnumerable, - IUserMessage message, + IUser user, + IMessageChannel message, string commandName, string moduleName, out int permIndex) @@ -18,7 +19,7 @@ public static class PermissionExtensions { var perm = perms[i]; - var result = perm.CheckPermission(message, commandName, moduleName); + var result = perm.CheckPermission(user, message, commandName, moduleName); if (result is null) continue; @@ -35,7 +36,8 @@ public static class PermissionExtensions //false = applicable, not allowed public static bool? CheckPermission( this Permissionv2 perm, - IUserMessage message, + IUser user, + IMessageChannel channel, string commandName, string moduleName) { @@ -46,16 +48,16 @@ public static class PermissionExtensions || perm.SecondaryTarget == SecondaryPermissionType.AllModules)) return null; - var guildUser = message.Author as IGuildUser; + var guildUser = user as IGuildUser; switch (perm.PrimaryTarget) { case PrimaryPermissionType.User: - if (perm.PrimaryTargetId == message.Author.Id) + if (perm.PrimaryTargetId == user.Id) return perm.State; break; case PrimaryPermissionType.Channel: - if (perm.PrimaryTargetId == message.Channel.Id) + if (perm.PrimaryTargetId == channel.Id) return perm.State; break; case PrimaryPermissionType.Role: diff --git a/src/NadekoBot/Modules/Permissions/PermissionsService.cs b/src/NadekoBot/Modules/Permissions/PermissionsService.cs index d3a311912..532384cc0 100644 --- a/src/NadekoBot/Modules/Permissions/PermissionsService.cs +++ b/src/NadekoBot/Modules/Permissions/PermissionsService.cs @@ -108,7 +108,8 @@ public class PermissionService : IExecPreCommand, INService var resetCommand = commandName == "resetperms"; var pc = GetCacheFor(guild.Id); - if (!resetCommand && !pc.Permissions.CheckPermissions(msg, commandName, moduleName, out var index)) + if (!resetCommand + && !pc.Permissions.CheckPermissions(msg.Author, msg.Channel, commandName, moduleName, out var index)) { if (pc.Verbose) { diff --git a/src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs b/src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs index bbc3d301c..3c831f737 100644 --- a/src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs +++ b/src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs @@ -835,10 +835,4 @@ public sealed class PatronageService public PatronConfigData GetConfig() => _pConf.Data; -} - -public readonly struct FeatureLimitKey -{ - public string PrettyName { get; init; } - public string Key { get; init; } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Utility/Remind/RemindService.cs b/src/NadekoBot/Modules/Utility/Remind/RemindService.cs index f9e87d58a..60b4c992b 100644 --- a/src/NadekoBot/Modules/Utility/Remind/RemindService.cs +++ b/src/NadekoBot/Modules/Utility/Remind/RemindService.cs @@ -8,7 +8,7 @@ using System.Text.RegularExpressions; namespace NadekoBot.Modules.Utility.Services; -public class RemindService : INService, IReadyExecutor +public class RemindService : INService, IReadyExecutor, IRemindService { private readonly Regex _regex = new(@"^(?:(?:at|on(?:\sthe)?)?\s*(?(?:\d{2}:\d{2}\s)?\d{1,2}\.\d{1,2}(?:\.\d{2,4})?)|(?:in\s?)?\s*(?:(?\d+)(?:\s?(?:months?|mos?),?))?(?:(?:\sand\s|\s*)?(?\d+)(?:\s?(?:weeks?|w),?))?(?:(?:\sand\s|\s*)?(?\d+)(?:\s?(?:days?|d),?))?(?:(?:\sand\s|\s*)?(?\d+)(?:\s?(?:hours?|h),?))?(?:(?:\sand\s|\s*)?(?\d+)(?:\s?(?:minutes?|mins?|m),?))?)\s+(?:to:?\s+)?(?(?:\r\n|[\r\n]|.)+)", diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index df791c02d..e57f8a740 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -41,7 +41,7 @@ - + @@ -56,8 +56,8 @@ - - + + @@ -107,7 +107,9 @@ - + + + @@ -123,6 +125,12 @@ Always + + + + + + 5.0.0 diff --git a/src/NadekoBot/PermissionChecker.cs b/src/NadekoBot/PermissionChecker.cs new file mode 100644 index 000000000..f5498d542 --- /dev/null +++ b/src/NadekoBot/PermissionChecker.cs @@ -0,0 +1,78 @@ +using Nadeko.Bot.Common; +using NadekoBot.Modules.Permissions.Common; +using NadekoBot.Modules.Permissions.Services; +using OneOf; +using OneOf.Types; + +namespace NadekoBot; + +public sealed class PermissionChecker : IPermissionChecker, INService +{ + private readonly PermissionService _perms; + private readonly GlobalPermissionService _gperm; + private readonly CmdCdService _cmdCds; + + public PermissionChecker(PermissionService perms, GlobalPermissionService gperm, CmdCdService cmdCds) + { + _perms = perms; + _gperm = gperm; + _cmdCds = cmdCds; + } + + public async Task>> CheckAsync( + IGuild guild, + IMessageChannel channel, + IUser author, + string module, + string cmd) + { + // todo add proper string + if (await _cmdCds.TryBlock(guild, author, cmd)) + return new Error(new()); + + try + { + if (_gperm.BlockedModules.Contains(module)) + { + Log.Information("u:{UserId} tried to use module {Module} which is globally disabled.", + author.Id, + module + ); + + return new Success(); + } + + if (guild is SocketGuild sg) + { + var pc = _perms.GetCacheFor(guild.Id); + if (!pc.Permissions.CheckPermissions(author, channel, cmd, "ACTUALEXPRESSIONS", out var index)) + { + if (pc.Verbose) + { + // todo fix + // var permissionMessage = strs.perm_prevent(index + 1, + // Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), sg))); + // + // try + // { + // await msg.Channel.SendErrorAsync(_eb, permissionMessage); + // } + // catch + // { + // } + // + // Log.Information("{PermissionMessage}", permissionMessage); + } + + // todo add proper string + return new Error(new()); + } + } + } + catch + { + } + + return new Success(); + } +} \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/BotCredsProvider.cs b/src/NadekoBot/Services/Impl/BotCredsProvider.cs index 2876e64ad..3bef56503 100644 --- a/src/NadekoBot/Services/Impl/BotCredsProvider.cs +++ b/src/NadekoBot/Services/Impl/BotCredsProvider.cs @@ -60,9 +60,16 @@ public sealed class BotCredsProvider : IBotCredsProvider CredsExamplePath); } - _config = new ConfigurationBuilder().AddYamlFile(CredsPath, false, true) - .AddEnvironmentVariables("NadekoBot_") - .Build(); + try + { + _config = new ConfigurationBuilder().AddYamlFile(CredsPath, false, true) + .AddEnvironmentVariables("NadekoBot_") + .Build(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } _changeToken = ChangeToken.OnChange(() => _config.GetReloadToken(), Reload); Reload(); diff --git a/src/NadekoBot/Services/Impl/RedisImagesCache.cs b/src/NadekoBot/Services/Impl/ImageCache.cs similarity index 70% rename from src/NadekoBot/Services/Impl/RedisImagesCache.cs rename to src/NadekoBot/Services/Impl/ImageCache.cs index 9957f8fdd..6c3292416 100644 --- a/src/NadekoBot/Services/Impl/RedisImagesCache.cs +++ b/src/NadekoBot/Services/Impl/ImageCache.cs @@ -1,38 +1,4 @@ -using NadekoBot.Common.Configs; - -namespace NadekoBot.Services; - -public sealed class ImagesConfig : ConfigServiceBase -{ - private const string PATH = "data/images.yml"; - - private static readonly TypedKey _changeKey = - new("config.images.updated"); - - public override string Name - => "images"; - - public ImagesConfig(IConfigSeria serializer, IPubSub pubSub) - : base(PATH, serializer, pubSub, _changeKey) - { - } -} - -public interface IImageCache -{ - Task GetHeadsImageAsync(); - Task GetTailsImageAsync(); - Task GetCurrencyImageAsync(); - Task GetXpBackgroundImageAsync(); - Task GetRategirlBgAsync(); - Task GetRategirlDotAsync(); - Task GetDiceAsync(int num); - Task GetSlotEmojiAsync(int number); - Task GetSlotBgAsync(); - Task GetRipBgAsync(); - Task GetRipOverlayAsync(); - Task GetImageDataAsync(Uri url); -} +namespace NadekoBot.Services; public sealed class ImageCache : IImageCache, INService { @@ -114,4 +80,4 @@ public sealed class ImageCache : IImageCache, INService public Task GetRipOverlayAsync() => GetImageDataAsync(_ic.Data.Rip.Overlay); -} +} \ No newline at end of file diff --git a/src/NadekoBot/Common/PubSub/JsonSeria.cs b/src/NadekoBot/Services/Impl/PubSub/JsonSeria.cs similarity index 100% rename from src/NadekoBot/Common/PubSub/JsonSeria.cs rename to src/NadekoBot/Services/Impl/PubSub/JsonSeria.cs diff --git a/src/NadekoBot/Common/PubSub/RedisPubSub.cs b/src/NadekoBot/Services/Impl/PubSub/RedisPubSub.cs similarity index 100% rename from src/NadekoBot/Common/PubSub/RedisPubSub.cs rename to src/NadekoBot/Services/Impl/PubSub/RedisPubSub.cs diff --git a/src/NadekoBot/Common/PubSub/YamlSeria.cs b/src/NadekoBot/Services/Impl/PubSub/YamlSeria.cs similarity index 100% rename from src/NadekoBot/Common/PubSub/YamlSeria.cs rename to src/NadekoBot/Services/Impl/PubSub/YamlSeria.cs diff --git a/src/NadekoBot/Common/Cache/RedisBotCache.cs b/src/NadekoBot/Services/Impl/RedisBotCache.cs similarity index 100% rename from src/NadekoBot/Common/Cache/RedisBotCache.cs rename to src/NadekoBot/Services/Impl/RedisBotCache.cs diff --git a/src/NadekoBot/Services/strings/impl/RedisBotStringsProvider.cs b/src/NadekoBot/Services/Impl/RedisBotStringsProvider.cs similarity index 100% rename from src/NadekoBot/Services/strings/impl/RedisBotStringsProvider.cs rename to src/NadekoBot/Services/Impl/RedisBotStringsProvider.cs diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index e1371e5e5..493508609 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -7,14 +7,11 @@ namespace NadekoBot.Services; public sealed class StatsService : IStatsService, IReadyExecutor, INService { - public const string BOT_VERSION = "4.3.13"; + public const string BOT_VERSION = "5.0.0-alpha1"; public string Author => "Kwoth#2452"; - public string Library - => "Discord.Net"; - public double MessagesPerSecond => MessageCounter / GetUptime().TotalSeconds; diff --git a/src/Nadeko.Bot.Common/data/aliases.yml b/src/NadekoBot/data/aliases.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/aliases.yml rename to src/NadekoBot/data/aliases.yml diff --git a/src/Nadeko.Bot.Common/data/bot.yml b/src/NadekoBot/data/bot.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/bot.yml rename to src/NadekoBot/data/bot.yml diff --git a/src/Nadeko.Bot.Common/data/fonts/NotoSans-Bold.ttf b/src/NadekoBot/data/fonts/NotoSans-Bold.ttf similarity index 100% rename from src/Nadeko.Bot.Common/data/fonts/NotoSans-Bold.ttf rename to src/NadekoBot/data/fonts/NotoSans-Bold.ttf diff --git a/src/Nadeko.Bot.Common/data/fonts/Symbola-10.24.ttf b/src/NadekoBot/data/fonts/Symbola-10.24.ttf similarity index 100% rename from src/Nadeko.Bot.Common/data/fonts/Symbola-10.24.ttf rename to src/NadekoBot/data/fonts/Symbola-10.24.ttf diff --git a/src/Nadeko.Bot.Common/data/fonts/Uni Sans.ttf b/src/NadekoBot/data/fonts/Uni Sans.ttf similarity index 100% rename from src/Nadeko.Bot.Common/data/fonts/Uni Sans.ttf rename to src/NadekoBot/data/fonts/Uni Sans.ttf diff --git a/src/Nadeko.Bot.Common/data/fonts/dotty.ttf b/src/NadekoBot/data/fonts/dotty.ttf similarity index 100% rename from src/Nadeko.Bot.Common/data/fonts/dotty.ttf rename to src/NadekoBot/data/fonts/dotty.ttf diff --git a/src/Nadeko.Bot.Common/data/gambling.yml b/src/NadekoBot/data/gambling.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/gambling.yml rename to src/NadekoBot/data/gambling.yml diff --git a/src/Nadeko.Bot.Common/data/games.yml b/src/NadekoBot/data/games.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/games.yml rename to src/NadekoBot/data/games.yml diff --git a/src/Nadeko.Bot.Common/data/hangman/animals.yml b/src/NadekoBot/data/hangman/animals.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/hangman/animals.yml rename to src/NadekoBot/data/hangman/animals.yml diff --git a/src/Nadeko.Bot.Common/data/hangman/anime.yml b/src/NadekoBot/data/hangman/anime.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/hangman/anime.yml rename to src/NadekoBot/data/hangman/anime.yml diff --git a/src/Nadeko.Bot.Common/data/hangman/countries.yml b/src/NadekoBot/data/hangman/countries.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/hangman/countries.yml rename to src/NadekoBot/data/hangman/countries.yml diff --git a/src/Nadeko.Bot.Common/data/hangman/movies.yml b/src/NadekoBot/data/hangman/movies.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/hangman/movies.yml rename to src/NadekoBot/data/hangman/movies.yml diff --git a/src/Nadeko.Bot.Common/data/hangman/things.yml b/src/NadekoBot/data/hangman/things.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/hangman/things.yml rename to src/NadekoBot/data/hangman/things.yml diff --git a/src/Nadeko.Bot.Common/data/images.yml b/src/NadekoBot/data/images.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/images.yml rename to src/NadekoBot/data/images.yml diff --git a/src/Nadeko.Bot.Common/data/images/cards/ace_of_clubs.jpg b/src/NadekoBot/data/images/cards/ace_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ace_of_clubs.jpg rename to src/NadekoBot/data/images/cards/ace_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ace_of_diamonds.jpg b/src/NadekoBot/data/images/cards/ace_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ace_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/ace_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ace_of_hearts.jpg b/src/NadekoBot/data/images/cards/ace_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ace_of_hearts.jpg rename to src/NadekoBot/data/images/cards/ace_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ace_of_spades.jpg b/src/NadekoBot/data/images/cards/ace_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ace_of_spades.jpg rename to src/NadekoBot/data/images/cards/ace_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/black_joker.jpg b/src/NadekoBot/data/images/cards/black_joker.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/black_joker.jpg rename to src/NadekoBot/data/images/cards/black_joker.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/eight_of_clubs.jpg b/src/NadekoBot/data/images/cards/eight_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/eight_of_clubs.jpg rename to src/NadekoBot/data/images/cards/eight_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/eight_of_diamonds.jpg b/src/NadekoBot/data/images/cards/eight_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/eight_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/eight_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/eight_of_hearts.jpg b/src/NadekoBot/data/images/cards/eight_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/eight_of_hearts.jpg rename to src/NadekoBot/data/images/cards/eight_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/eight_of_spades.jpg b/src/NadekoBot/data/images/cards/eight_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/eight_of_spades.jpg rename to src/NadekoBot/data/images/cards/eight_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/five_of_clubs.jpg b/src/NadekoBot/data/images/cards/five_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/five_of_clubs.jpg rename to src/NadekoBot/data/images/cards/five_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/five_of_diamonds.jpg b/src/NadekoBot/data/images/cards/five_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/five_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/five_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/five_of_hearts.jpg b/src/NadekoBot/data/images/cards/five_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/five_of_hearts.jpg rename to src/NadekoBot/data/images/cards/five_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/five_of_spades.jpg b/src/NadekoBot/data/images/cards/five_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/five_of_spades.jpg rename to src/NadekoBot/data/images/cards/five_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/four_of_clubs.jpg b/src/NadekoBot/data/images/cards/four_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/four_of_clubs.jpg rename to src/NadekoBot/data/images/cards/four_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/four_of_diamonds.jpg b/src/NadekoBot/data/images/cards/four_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/four_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/four_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/four_of_hearts.jpg b/src/NadekoBot/data/images/cards/four_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/four_of_hearts.jpg rename to src/NadekoBot/data/images/cards/four_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/four_of_spades.jpg b/src/NadekoBot/data/images/cards/four_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/four_of_spades.jpg rename to src/NadekoBot/data/images/cards/four_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/jack_of_clubs.jpg b/src/NadekoBot/data/images/cards/jack_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/jack_of_clubs.jpg rename to src/NadekoBot/data/images/cards/jack_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/jack_of_diamonds.jpg b/src/NadekoBot/data/images/cards/jack_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/jack_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/jack_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/jack_of_hearts.jpg b/src/NadekoBot/data/images/cards/jack_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/jack_of_hearts.jpg rename to src/NadekoBot/data/images/cards/jack_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/jack_of_spades.jpg b/src/NadekoBot/data/images/cards/jack_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/jack_of_spades.jpg rename to src/NadekoBot/data/images/cards/jack_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/king_of_clubs.jpg b/src/NadekoBot/data/images/cards/king_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/king_of_clubs.jpg rename to src/NadekoBot/data/images/cards/king_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/king_of_diamonds.jpg b/src/NadekoBot/data/images/cards/king_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/king_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/king_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/king_of_hearts.jpg b/src/NadekoBot/data/images/cards/king_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/king_of_hearts.jpg rename to src/NadekoBot/data/images/cards/king_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/king_of_spades.jpg b/src/NadekoBot/data/images/cards/king_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/king_of_spades.jpg rename to src/NadekoBot/data/images/cards/king_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/nine_of_clubs.jpg b/src/NadekoBot/data/images/cards/nine_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/nine_of_clubs.jpg rename to src/NadekoBot/data/images/cards/nine_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/nine_of_diamonds.jpg b/src/NadekoBot/data/images/cards/nine_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/nine_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/nine_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/nine_of_hearts.jpg b/src/NadekoBot/data/images/cards/nine_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/nine_of_hearts.jpg rename to src/NadekoBot/data/images/cards/nine_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/nine_of_spades.jpg b/src/NadekoBot/data/images/cards/nine_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/nine_of_spades.jpg rename to src/NadekoBot/data/images/cards/nine_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/queen_of_clubs.jpg b/src/NadekoBot/data/images/cards/queen_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/queen_of_clubs.jpg rename to src/NadekoBot/data/images/cards/queen_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/queen_of_diamonds.jpg b/src/NadekoBot/data/images/cards/queen_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/queen_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/queen_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/queen_of_hearts.jpg b/src/NadekoBot/data/images/cards/queen_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/queen_of_hearts.jpg rename to src/NadekoBot/data/images/cards/queen_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/queen_of_spades.jpg b/src/NadekoBot/data/images/cards/queen_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/queen_of_spades.jpg rename to src/NadekoBot/data/images/cards/queen_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/red_joker.jpg b/src/NadekoBot/data/images/cards/red_joker.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/red_joker.jpg rename to src/NadekoBot/data/images/cards/red_joker.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/seven_of_clubs.jpg b/src/NadekoBot/data/images/cards/seven_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/seven_of_clubs.jpg rename to src/NadekoBot/data/images/cards/seven_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/seven_of_diamonds.jpg b/src/NadekoBot/data/images/cards/seven_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/seven_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/seven_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/seven_of_hearts.jpg b/src/NadekoBot/data/images/cards/seven_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/seven_of_hearts.jpg rename to src/NadekoBot/data/images/cards/seven_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/seven_of_spades.jpg b/src/NadekoBot/data/images/cards/seven_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/seven_of_spades.jpg rename to src/NadekoBot/data/images/cards/seven_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/six_of_clubs.jpg b/src/NadekoBot/data/images/cards/six_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/six_of_clubs.jpg rename to src/NadekoBot/data/images/cards/six_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/six_of_diamonds.jpg b/src/NadekoBot/data/images/cards/six_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/six_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/six_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/six_of_hearts.jpg b/src/NadekoBot/data/images/cards/six_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/six_of_hearts.jpg rename to src/NadekoBot/data/images/cards/six_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/six_of_spades.jpg b/src/NadekoBot/data/images/cards/six_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/six_of_spades.jpg rename to src/NadekoBot/data/images/cards/six_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ten_of_clubs.jpg b/src/NadekoBot/data/images/cards/ten_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ten_of_clubs.jpg rename to src/NadekoBot/data/images/cards/ten_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ten_of_diamonds.jpg b/src/NadekoBot/data/images/cards/ten_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ten_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/ten_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ten_of_hearts.jpg b/src/NadekoBot/data/images/cards/ten_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ten_of_hearts.jpg rename to src/NadekoBot/data/images/cards/ten_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/ten_of_spades.jpg b/src/NadekoBot/data/images/cards/ten_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/ten_of_spades.jpg rename to src/NadekoBot/data/images/cards/ten_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/three_of_clubs.jpg b/src/NadekoBot/data/images/cards/three_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/three_of_clubs.jpg rename to src/NadekoBot/data/images/cards/three_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/three_of_diamonds.jpg b/src/NadekoBot/data/images/cards/three_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/three_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/three_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/three_of_hearts.jpg b/src/NadekoBot/data/images/cards/three_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/three_of_hearts.jpg rename to src/NadekoBot/data/images/cards/three_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/three_of_spades.jpg b/src/NadekoBot/data/images/cards/three_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/three_of_spades.jpg rename to src/NadekoBot/data/images/cards/three_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/two_of_clubs.jpg b/src/NadekoBot/data/images/cards/two_of_clubs.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/two_of_clubs.jpg rename to src/NadekoBot/data/images/cards/two_of_clubs.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/two_of_diamonds.jpg b/src/NadekoBot/data/images/cards/two_of_diamonds.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/two_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/two_of_diamonds.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/two_of_hearts.jpg b/src/NadekoBot/data/images/cards/two_of_hearts.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/two_of_hearts.jpg rename to src/NadekoBot/data/images/cards/two_of_hearts.jpg diff --git a/src/Nadeko.Bot.Common/data/images/cards/two_of_spades.jpg b/src/NadekoBot/data/images/cards/two_of_spades.jpg similarity index 100% rename from src/Nadeko.Bot.Common/data/images/cards/two_of_spades.jpg rename to src/NadekoBot/data/images/cards/two_of_spades.jpg diff --git a/src/Nadeko.Bot.Common/data/images/frame_gold.png b/src/NadekoBot/data/images/frame_gold.png similarity index 100% rename from src/Nadeko.Bot.Common/data/images/frame_gold.png rename to src/NadekoBot/data/images/frame_gold.png diff --git a/src/Nadeko.Bot.Common/data/images/frame_silver.png b/src/NadekoBot/data/images/frame_silver.png similarity index 100% rename from src/Nadeko.Bot.Common/data/images/frame_silver.png rename to src/NadekoBot/data/images/frame_silver.png diff --git a/src/Nadeko.Bot.Common/data/lib/libopus.so b/src/NadekoBot/data/lib/libopus.so similarity index 100% rename from src/Nadeko.Bot.Common/data/lib/libopus.so rename to src/NadekoBot/data/lib/libopus.so diff --git a/src/Nadeko.Bot.Common/data/lib/libsodium.dll b/src/NadekoBot/data/lib/libsodium.dll similarity index 100% rename from src/Nadeko.Bot.Common/data/lib/libsodium.dll rename to src/NadekoBot/data/lib/libsodium.dll diff --git a/src/Nadeko.Bot.Common/data/lib/libsodium.so b/src/NadekoBot/data/lib/libsodium.so similarity index 100% rename from src/Nadeko.Bot.Common/data/lib/libsodium.so rename to src/NadekoBot/data/lib/libsodium.so diff --git a/src/Nadeko.Bot.Common/data/lib/opus.dll b/src/NadekoBot/data/lib/opus.dll similarity index 100% rename from src/Nadeko.Bot.Common/data/lib/opus.dll rename to src/NadekoBot/data/lib/opus.dll diff --git a/src/Nadeko.Bot.Common/data/magicitems.json b/src/NadekoBot/data/magicitems.json similarity index 100% rename from src/Nadeko.Bot.Common/data/magicitems.json rename to src/NadekoBot/data/magicitems.json diff --git a/src/Nadeko.Bot.Common/data/patron.yml b/src/NadekoBot/data/patron.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/patron.yml rename to src/NadekoBot/data/patron.yml diff --git a/src/Nadeko.Bot.Common/data/pokemon/LICENSE b/src/NadekoBot/data/pokemon/LICENSE similarity index 100% rename from src/Nadeko.Bot.Common/data/pokemon/LICENSE rename to src/NadekoBot/data/pokemon/LICENSE diff --git a/src/Nadeko.Bot.Common/data/pokemon/name-id_map.json b/src/NadekoBot/data/pokemon/name-id_map.json similarity index 100% rename from src/Nadeko.Bot.Common/data/pokemon/name-id_map.json rename to src/NadekoBot/data/pokemon/name-id_map.json diff --git a/src/Nadeko.Bot.Common/data/pokemon/pokemon_abilities.json b/src/NadekoBot/data/pokemon/pokemon_abilities.json similarity index 100% rename from src/Nadeko.Bot.Common/data/pokemon/pokemon_abilities.json rename to src/NadekoBot/data/pokemon/pokemon_abilities.json diff --git a/src/Nadeko.Bot.Common/data/pokemon/pokemon_list.json b/src/NadekoBot/data/pokemon/pokemon_list.json similarity index 100% rename from src/Nadeko.Bot.Common/data/pokemon/pokemon_list.json rename to src/NadekoBot/data/pokemon/pokemon_list.json diff --git a/src/Nadeko.Bot.Common/data/searches.yml b/src/NadekoBot/data/searches.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/searches.yml rename to src/NadekoBot/data/searches.yml diff --git a/src/Nadeko.Bot.Common/data/strings/commands/commands.en-US.yml b/src/NadekoBot/data/strings/commands/commands.en-US.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/commands/commands.en-US.yml rename to src/NadekoBot/data/strings/commands/commands.en-US.yml diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.ar.json b/src/NadekoBot/data/strings/responses/responses.ar.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.ar.json rename to src/NadekoBot/data/strings/responses/responses.ar.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.cs-CZ.json b/src/NadekoBot/data/strings/responses/responses.cs-CZ.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.cs-CZ.json rename to src/NadekoBot/data/strings/responses/responses.cs-CZ.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.da-DK.json b/src/NadekoBot/data/strings/responses/responses.da-DK.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.da-DK.json rename to src/NadekoBot/data/strings/responses/responses.da-DK.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.de-DE.json b/src/NadekoBot/data/strings/responses/responses.de-DE.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.de-DE.json rename to src/NadekoBot/data/strings/responses/responses.de-DE.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.en-US.json b/src/NadekoBot/data/strings/responses/responses.en-US.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.en-US.json rename to src/NadekoBot/data/strings/responses/responses.en-US.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.es-ES.json b/src/NadekoBot/data/strings/responses/responses.es-ES.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.es-ES.json rename to src/NadekoBot/data/strings/responses/responses.es-ES.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.fr-FR.json b/src/NadekoBot/data/strings/responses/responses.fr-FR.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.fr-FR.json rename to src/NadekoBot/data/strings/responses/responses.fr-FR.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.he-IL.json b/src/NadekoBot/data/strings/responses/responses.he-IL.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.he-IL.json rename to src/NadekoBot/data/strings/responses/responses.he-IL.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.hu-HU.json b/src/NadekoBot/data/strings/responses/responses.hu-HU.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.hu-HU.json rename to src/NadekoBot/data/strings/responses/responses.hu-HU.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.id-ID.json b/src/NadekoBot/data/strings/responses/responses.id-ID.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.id-ID.json rename to src/NadekoBot/data/strings/responses/responses.id-ID.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.it-IT.json b/src/NadekoBot/data/strings/responses/responses.it-IT.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.it-IT.json rename to src/NadekoBot/data/strings/responses/responses.it-IT.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.ja-JP.json b/src/NadekoBot/data/strings/responses/responses.ja-JP.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.ja-JP.json rename to src/NadekoBot/data/strings/responses/responses.ja-JP.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.ko-KR.json b/src/NadekoBot/data/strings/responses/responses.ko-KR.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.ko-KR.json rename to src/NadekoBot/data/strings/responses/responses.ko-KR.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.nb-NO.json b/src/NadekoBot/data/strings/responses/responses.nb-NO.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.nb-NO.json rename to src/NadekoBot/data/strings/responses/responses.nb-NO.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.nl-NL.json b/src/NadekoBot/data/strings/responses/responses.nl-NL.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.nl-NL.json rename to src/NadekoBot/data/strings/responses/responses.nl-NL.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.pl-PL.json b/src/NadekoBot/data/strings/responses/responses.pl-PL.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.pl-PL.json rename to src/NadekoBot/data/strings/responses/responses.pl-PL.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.pt-BR.json b/src/NadekoBot/data/strings/responses/responses.pt-BR.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.pt-BR.json rename to src/NadekoBot/data/strings/responses/responses.pt-BR.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.ro-RO.json b/src/NadekoBot/data/strings/responses/responses.ro-RO.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.ro-RO.json rename to src/NadekoBot/data/strings/responses/responses.ro-RO.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.ru-RU.json b/src/NadekoBot/data/strings/responses/responses.ru-RU.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.ru-RU.json rename to src/NadekoBot/data/strings/responses/responses.ru-RU.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.sr-cyrl-rs.json b/src/NadekoBot/data/strings/responses/responses.sr-cyrl-rs.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.sr-cyrl-rs.json rename to src/NadekoBot/data/strings/responses/responses.sr-cyrl-rs.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.sv-SE.json b/src/NadekoBot/data/strings/responses/responses.sv-SE.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.sv-SE.json rename to src/NadekoBot/data/strings/responses/responses.sv-SE.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.tr-TR.json b/src/NadekoBot/data/strings/responses/responses.tr-TR.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.tr-TR.json rename to src/NadekoBot/data/strings/responses/responses.tr-TR.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.ts-TS.json b/src/NadekoBot/data/strings/responses/responses.ts-TS.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.ts-TS.json rename to src/NadekoBot/data/strings/responses/responses.ts-TS.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.uk-UA.json b/src/NadekoBot/data/strings/responses/responses.uk-UA.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.uk-UA.json rename to src/NadekoBot/data/strings/responses/responses.uk-UA.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.zh-CN.json b/src/NadekoBot/data/strings/responses/responses.zh-CN.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.zh-CN.json rename to src/NadekoBot/data/strings/responses/responses.zh-CN.json diff --git a/src/Nadeko.Bot.Common/data/strings/responses/responses.zh-TW.json b/src/NadekoBot/data/strings/responses/responses.zh-TW.json similarity index 100% rename from src/Nadeko.Bot.Common/data/strings/responses/responses.zh-TW.json rename to src/NadekoBot/data/strings/responses/responses.zh-TW.json diff --git a/src/Nadeko.Bot.Common/data/trivia_questions.json b/src/NadekoBot/data/trivia_questions.json similarity index 100% rename from src/Nadeko.Bot.Common/data/trivia_questions.json rename to src/NadekoBot/data/trivia_questions.json diff --git a/src/Nadeko.Bot.Common/data/typing_articles3.json b/src/NadekoBot/data/typing_articles3.json similarity index 100% rename from src/Nadeko.Bot.Common/data/typing_articles3.json rename to src/NadekoBot/data/typing_articles3.json diff --git a/src/Nadeko.Bot.Common/data/units.json b/src/NadekoBot/data/units.json similarity index 100% rename from src/Nadeko.Bot.Common/data/units.json rename to src/NadekoBot/data/units.json diff --git a/src/Nadeko.Bot.Common/data/urero.json b/src/NadekoBot/data/urero.json similarity index 100% rename from src/Nadeko.Bot.Common/data/urero.json rename to src/NadekoBot/data/urero.json diff --git a/src/Nadeko.Bot.Common/data/wowjokes.json b/src/NadekoBot/data/wowjokes.json similarity index 100% rename from src/Nadeko.Bot.Common/data/wowjokes.json rename to src/NadekoBot/data/wowjokes.json diff --git a/src/Nadeko.Bot.Common/data/xp.yml b/src/NadekoBot/data/xp.yml similarity index 100% rename from src/Nadeko.Bot.Common/data/xp.yml rename to src/NadekoBot/data/xp.yml diff --git a/src/Nadeko.Bot.Common/data/xp_template.json b/src/NadekoBot/data/xp_template.json similarity index 100% rename from src/Nadeko.Bot.Common/data/xp_template.json rename to src/NadekoBot/data/xp_template.json diff --git a/src/Nadeko.Bot.Common/data/yomama.txt b/src/NadekoBot/data/yomama.txt similarity index 100% rename from src/Nadeko.Bot.Common/data/yomama.txt rename to src/NadekoBot/data/yomama.txt