elliebot/src/Ellie.Bot.Common/CleanupModuleBase.cs
2023-08-03 15:11:17 +12:00

25 lines
No EOL
606 B
C#

#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());
}
}
}