Confirm before clearing (most) entity properties

This commit is contained in:
dev-kittens
2020-10-04 08:53:07 +00:00
parent 969065724d
commit dfacbc51ab
7 changed files with 32 additions and 21 deletions

View File

@@ -17,6 +17,12 @@ using PluralKit.Core;
namespace PluralKit.Bot {
public static class ContextUtils {
public static async Task<bool> ConfirmClear(this Context ctx, string toClear)
{
if (!(await ctx.PromptYesNo($"{Emojis.Warn} Are you sure you want to clear {toClear}?"))) throw Errors.GenericCancelled();
else return true;
}
public static async Task<bool> PromptYesNo(this Context ctx, String msgString, DiscordUser user = null, Duration? timeout = null, IEnumerable<IMention> mentions = null)
{
DiscordMessage message;