diff --git a/Ellie.sln b/Ellie.sln index b09dc66..3b03106 100644 --- a/Ellie.sln +++ b/Ellie.sln @@ -42,6 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ellie.Bot.Common", "src\Ell EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ellie.Bot.Generators.Cloneable", "src\Ellie.Bot.Generators.Cloneable\Ellie.Bot.Generators.Cloneable.csproj", "{AFA3DD12-0F98-4754-ADD7-9FF3C1A37C90}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ellie.Bot.Modules.Gambling", "src\Ellie.Bot.Modules.Gambling\Ellie.Bot.Modules.Gambling.csproj", "{11910E7D-E373-482F-8207-678DE0A88112}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -88,18 +90,22 @@ Global {F4D3A613-320A-40DD-975A-247186A20173}.Debug|Any CPU.Build.0 = Debug|Any CPU {F4D3A613-320A-40DD-975A-247186A20173}.Release|Any CPU.ActiveCfg = Release|Any CPU {F4D3A613-320A-40DD-975A-247186A20173}.Release|Any CPU.Build.0 = Release|Any CPU - {3EC0F005-560F-4E90-88CF-199520133BBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3EC0F005-560F-4E90-88CF-199520133BBA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3EC0F005-560F-4E90-88CF-199520133BBA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3EC0F005-560F-4E90-88CF-199520133BBA}.Release|Any CPU.Build.0 = Release|Any CPU {D3411F6C-320C-456D-BA86-24481EB000EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3411F6C-320C-456D-BA86-24481EB000EA}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3411F6C-320C-456D-BA86-24481EB000EA}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3411F6C-320C-456D-BA86-24481EB000EA}.Release|Any CPU.Build.0 = Release|Any CPU + {3EC0F005-560F-4E90-88CF-199520133BBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EC0F005-560F-4E90-88CF-199520133BBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EC0F005-560F-4E90-88CF-199520133BBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EC0F005-560F-4E90-88CF-199520133BBA}.Release|Any CPU.Build.0 = Release|Any CPU {AFA3DD12-0F98-4754-ADD7-9FF3C1A37C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFA3DD12-0F98-4754-ADD7-9FF3C1A37C90}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFA3DD12-0F98-4754-ADD7-9FF3C1A37C90}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFA3DD12-0F98-4754-ADD7-9FF3C1A37C90}.Release|Any CPU.Build.0 = Release|Any CPU + {11910E7D-E373-482F-8207-678DE0A88112}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11910E7D-E373-482F-8207-678DE0A88112}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11910E7D-E373-482F-8207-678DE0A88112}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11910E7D-E373-482F-8207-678DE0A88112}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -116,9 +122,10 @@ Global {227F78CC-633E-4B1F-A12B-DF8BFF30549C} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} {5E69237D-37C5-4EDF-9037-9C8FDF23FD86} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} {F4D3A613-320A-40DD-975A-247186A20173} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} - {3EC0F005-560F-4E90-88CF-199520133BBA} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} {D3411F6C-320C-456D-BA86-24481EB000EA} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} + {3EC0F005-560F-4E90-88CF-199520133BBA} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} {AFA3DD12-0F98-4754-ADD7-9FF3C1A37C90} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} + {11910E7D-E373-482F-8207-678DE0A88112} = {C5E3EF2E-72CF-41BB-B0C5-EB4C08403E67} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {878761F1-C7B5-4D38-A00D-3377D703EBBA} diff --git a/src/Ellie.Bot.Common/CleanupModuleBase.cs b/src/Ellie.Bot.Common/CleanupModuleBase.cs new file mode 100644 index 0000000..d7a77b8 --- /dev/null +++ b/src/Ellie.Bot.Common/CleanupModuleBase.cs @@ -0,0 +1,25 @@ +#nullable disable +namespace Ellie.Common; + +public abstract class CleanupModuleBase : EllieModule +{ + protected async Task ConfirmActionInternalAsync(string name, Func action) + { + try + { + var embed = _eb.Create() + .WithTitle(GetText(strs.sql_confirm_exec)) + .WithDescription(name); + + if (!await PromptUserConfirmAsync(embed)) + return; + + await action(); + await ctx.OkAsync(); + } + catch (Exception ex) + { + await SendErrorAsync(ex.ToString()); + } + } +} \ No newline at end of file diff --git a/src/Ellie.Bot.Common/Ellie.Bot.Common.csproj b/src/Ellie.Bot.Common/Ellie.Bot.Common.csproj index 5a4866e..42273f3 100644 --- a/src/Ellie.Bot.Common/Ellie.Bot.Common.csproj +++ b/src/Ellie.Bot.Common/Ellie.Bot.Common.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -7,7 +7,7 @@ - + diff --git a/src/Ellie.Bot.Common/EllieModule.cs b/src/Ellie.Bot.Common/EllieModule.cs index f9e1202..1a5ce63 100644 --- a/src/Ellie.Bot.Common/EllieModule.cs +++ b/src/Ellie.Bot.Common/EllieModule.cs @@ -49,8 +49,10 @@ public abstract class EllieModule : ModuleBase // public Task SendErrorAsync(string text, EllieInteraction inter = null) => ctx.Channel.SendAsync(_eb, text, MsgType.Error, inter); + public Task SendConfirmAsync(string text, EllieInteraction inter = null) => ctx.Channel.SendAsync(_eb, text, MsgType.Ok, inter); + public Task SendPendingAsync(string text, EllieInteraction inter = null) => ctx.Channel.SendAsync(_eb, text, MsgType.Pending, inter); @@ -138,4 +140,4 @@ public abstract class EllieModule : ModuleBase public abstract class EllieModule : EllieModule { public TService _service { get; set; } -} +} \ No newline at end of file diff --git a/src/Ellie.Bot.Common/Common/AddRemove.cs b/src/Ellie.Bot.Common/_common/AddRemove.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/AddRemove.cs rename to src/Ellie.Bot.Common/_common/AddRemove.cs diff --git a/src/Ellie.Bot.Common/Common/CmdStrings.cs b/src/Ellie.Bot.Common/_common/CmdStrings.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/CmdStrings.cs rename to src/Ellie.Bot.Common/_common/CmdStrings.cs diff --git a/src/Ellie.Bot.Common/Common/CommandData.cs b/src/Ellie.Bot.Common/_common/CommandData.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/CommandData.cs rename to src/Ellie.Bot.Common/_common/CommandData.cs diff --git a/src/Ellie.Bot.Common/Common/DownloadTracker.cs b/src/Ellie.Bot.Common/_common/DownloadTracker.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/DownloadTracker.cs rename to src/Ellie.Bot.Common/_common/DownloadTracker.cs diff --git a/src/Ellie.Bot.Common/Common/Helpers.cs b/src/Ellie.Bot.Common/_common/Helpers.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/Helpers.cs rename to src/Ellie.Bot.Common/_common/Helpers.cs diff --git a/src/Ellie.Bot.Common/Common/ImageUrls.cs b/src/Ellie.Bot.Common/_common/ImageUrls.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/ImageUrls.cs rename to src/Ellie.Bot.Common/_common/ImageUrls.cs diff --git a/src/Ellie.Bot.Common/Common/JsonConverters/CultureInfoConverter.cs b/src/Ellie.Bot.Common/_common/JsonConverters/CultureInfoConverter.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/JsonConverters/CultureInfoConverter.cs rename to src/Ellie.Bot.Common/_common/JsonConverters/CultureInfoConverter.cs diff --git a/src/Ellie.Bot.Common/Common/JsonConverters/Rgba32Converter.cs b/src/Ellie.Bot.Common/_common/JsonConverters/Rgba32Converter.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/JsonConverters/Rgba32Converter.cs rename to src/Ellie.Bot.Common/_common/JsonConverters/Rgba32Converter.cs diff --git a/src/Ellie.Bot.Common/Common/LbOpts.cs b/src/Ellie.Bot.Common/_common/LbOpts.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/LbOpts.cs rename to src/Ellie.Bot.Common/_common/LbOpts.cs diff --git a/src/Ellie.Bot.Common/Common/Linq2DbExpressions.cs b/src/Ellie.Bot.Common/_common/Linq2DbExpressions.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/Linq2DbExpressions.cs rename to src/Ellie.Bot.Common/_common/Linq2DbExpressions.cs diff --git a/src/Ellie.Bot.Common/Common/LoginErrorHandler.cs b/src/Ellie.Bot.Common/_common/LoginErrorHandler.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/LoginErrorHandler.cs rename to src/Ellie.Bot.Common/_common/LoginErrorHandler.cs diff --git a/src/Ellie.Bot.Common/Common/OldCreds.cs b/src/Ellie.Bot.Common/_common/OldCreds.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/OldCreds.cs rename to src/Ellie.Bot.Common/_common/OldCreds.cs diff --git a/src/Ellie.Bot.Common/Common/OptionsParser.cs b/src/Ellie.Bot.Common/_common/OptionsParser.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/OptionsParser.cs rename to src/Ellie.Bot.Common/_common/OptionsParser.cs diff --git a/src/Ellie.Bot.Common/Common/OsuMapData.cs b/src/Ellie.Bot.Common/_common/OsuMapData.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/OsuMapData.cs rename to src/Ellie.Bot.Common/_common/OsuMapData.cs diff --git a/src/Ellie.Bot.Common/Common/OsuUserBets.cs b/src/Ellie.Bot.Common/_common/OsuUserBets.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/OsuUserBets.cs rename to src/Ellie.Bot.Common/_common/OsuUserBets.cs diff --git a/src/Ellie.Bot.Common/Common/Pokemon/PokemonNameId.cs b/src/Ellie.Bot.Common/_common/Pokemon/PokemonNameId.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/Pokemon/PokemonNameId.cs rename to src/Ellie.Bot.Common/_common/Pokemon/PokemonNameId.cs diff --git a/src/Ellie.Bot.Common/Common/Pokemon/SearchPokemon.cs b/src/Ellie.Bot.Common/_common/Pokemon/SearchPokemon.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/Pokemon/SearchPokemon.cs rename to src/Ellie.Bot.Common/_common/Pokemon/SearchPokemon.cs diff --git a/src/Ellie.Bot.Common/Common/Pokemon/SearchPokemonAbility.cs b/src/Ellie.Bot.Common/_common/Pokemon/SearchPokemonAbility.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/Pokemon/SearchPokemonAbility.cs rename to src/Ellie.Bot.Common/_common/Pokemon/SearchPokemonAbility.cs diff --git a/src/Ellie.Bot.Common/Common/RequireObjectPropertiesContractResolver.cs b/src/Ellie.Bot.Common/_common/RequireObjectPropertiesContractResolver.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/RequireObjectPropertiesContractResolver.cs rename to src/Ellie.Bot.Common/_common/RequireObjectPropertiesContractResolver.cs diff --git a/src/Ellie.Bot.Common/Common/TriviaQuestionModel.cs b/src/Ellie.Bot.Common/_common/TriviaQuestionModel.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TriviaQuestionModel.cs rename to src/Ellie.Bot.Common/_common/TriviaQuestionModel.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/EmoteTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/EmoteTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/EmoteTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/EmoteTypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/GuildTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/GuildTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/GuildTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/GuildTypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/GuildUserTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/GuildUserTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/GuildUserTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/GuildUserTypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/KwumTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/KwumTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/KwumTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/KwumTypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/Models/PermissionAction.cs b/src/Ellie.Bot.Common/_common/TypeReaders/Models/PermissionAction.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/Models/PermissionAction.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/Models/PermissionAction.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/Models/StoopidTime.cs b/src/Ellie.Bot.Common/_common/TypeReaders/Models/StoopidTime.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/Models/StoopidTime.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/Models/StoopidTime.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/ModuleTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/ModuleTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/ModuleTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/ModuleTypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/PermissionActionTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/PermissionActionTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/PermissionActionTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/PermissionActionTypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/Rgba32TypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/Rgba32TypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/Rgba32TypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/Rgba32TypeReader.cs diff --git a/src/Ellie.Bot.Common/Common/TypeReaders/StoopidTimeTypeReader.cs b/src/Ellie.Bot.Common/_common/TypeReaders/StoopidTimeTypeReader.cs similarity index 100% rename from src/Ellie.Bot.Common/Common/TypeReaders/StoopidTimeTypeReader.cs rename to src/Ellie.Bot.Common/_common/TypeReaders/StoopidTimeTypeReader.cs