25 lines
606 B
C#
25 lines
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());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|