Updated Ellie.Bot.Common

This commit is contained in:
Emotion 2023-08-03 15:11:17 +12:00
parent 2aef2ac973
commit 9b55607ffb
No known key found for this signature in database
GPG key ID: D7D3E4C27A98C37B
34 changed files with 42 additions and 8 deletions

View file

@ -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}

View file

@ -0,0 +1,25 @@
#nullable disable
namespace Ellie.Common;
public abstract class CleanupModuleBase : EllieModule
{
protected async Task ConfirmActionInternalAsync(string name, Func<Task> 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());
}
}
}

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Discord.Net" Version="3.104.0" />
<PackageReference Include="Discord.Net" Version="3.11.0" />
</ItemGroup>
<ItemGroup>

View file

@ -49,8 +49,10 @@ public abstract class EllieModule : ModuleBase
//
public Task<IUserMessage> SendErrorAsync(string text, EllieInteraction inter = null)
=> ctx.Channel.SendAsync(_eb, text, MsgType.Error, inter);
public Task<IUserMessage> SendConfirmAsync(string text, EllieInteraction inter = null)
=> ctx.Channel.SendAsync(_eb, text, MsgType.Ok, inter);
public Task<IUserMessage> 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<TService> : EllieModule
{
public TService _service { get; set; }
}
}