diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index 6318b91d..d2f421c7 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -574,10 +574,10 @@ public class Groups ctx.CheckOwnGroup(target); await ctx.Reply( - $"{Emojis.Warn} Are you sure you want to delete this group? If so, reply to this message with the group's ID (`{target.Hid}`).\n**Note: this action is permanent.**"); - if (!await ctx.ConfirmWithReply(target.Hid)) + $"{Emojis.Warn} Are you sure you want to delete this group? If so, reply to this message with the group's ID (`{target.DisplayHid(ctx.Config)}`).\n**Note: this action is permanent.**"); + if (!await ctx.ConfirmWithReply(target.Hid, treatAsHid: true)) throw new PKError( - $"Group deletion cancelled. Note that you must reply with your group ID (`{target.Hid}`) *verbatim*."); + $"Group deletion cancelled. Note that you must reply with your group ID (`{target.DisplayHid(ctx.Config)}`) *verbatim*."); await ctx.Repository.DeleteGroup(target.Id); diff --git a/PluralKit.Bot/Commands/MemberEdit.cs b/PluralKit.Bot/Commands/MemberEdit.cs index 49f066bc..36b55e74 100644 --- a/PluralKit.Bot/Commands/MemberEdit.cs +++ b/PluralKit.Bot/Commands/MemberEdit.cs @@ -816,8 +816,8 @@ public class MemberEdit ctx.CheckSystem().CheckOwnMember(target); await ctx.Reply( - $"{Emojis.Warn} Are you sure you want to delete \"{target.NameFor(ctx)}\"? If so, reply to this message with the member's ID (`{target.Hid}`). __***This cannot be undone!***__"); - if (!await ctx.ConfirmWithReply(target.Hid)) throw Errors.MemberDeleteCancelled; + $"{Emojis.Warn} Are you sure you want to delete \"{target.NameFor(ctx)}\"? If so, reply to this message with the member's ID (`{target.DisplayHid(ctx.Config)}`). __***This cannot be undone!***__"); + if (!await ctx.ConfirmWithReply(target.Hid, treatAsHid: true)) throw Errors.MemberDeleteCancelled; await ctx.Repository.DeleteMember(target.Id); diff --git a/PluralKit.Bot/Commands/SystemEdit.cs b/PluralKit.Bot/Commands/SystemEdit.cs index c8c501c1..a3bcaa64 100644 --- a/PluralKit.Bot/Commands/SystemEdit.cs +++ b/PluralKit.Bot/Commands/SystemEdit.cs @@ -670,19 +670,20 @@ public class SystemEdit public async Task Delete(Context ctx, PKSystem target) { ctx.CheckSystem().CheckOwnSystem(target); + var noExport = ctx.MatchFlag("ne", "no-export"); - await ctx.Reply( - $"{Emojis.Warn} Are you sure you want to delete your system? If so, reply to this message with your system's ID (`{target.Hid}`).\n" - + $"**Note: this action is permanent,** but you will get a copy of your system's data that can be re-imported into PluralKit at a later date sent to you in DMs." - + " If you don't want this to happen, use `pk;s delete -no-export` instead."); - if (!await ctx.ConfirmWithReply(target.Hid)) + var warnMsg = $"{Emojis.Warn} Are you sure you want to delete your system? If so, reply to this message with your system's ID (`{target.DisplayHid(ctx.Config)}`).\n"; + if (!noExport) + warnMsg += "**Note: this action is permanent,** but you will get a copy of your system's data that can be re-imported into PluralKit at a later date sent to you in DMs." + + " If you don't want this to happen, use `pk;s delete -no-export` instead."; + + await ctx.Reply(warnMsg); + if (!await ctx.ConfirmWithReply(target.Hid, treatAsHid: true)) throw new PKError( - $"System deletion cancelled. Note that you must reply with your system ID (`{target.Hid}`) *verbatim*."); + $"System deletion cancelled. Note that you must reply with your system ID (`{target.DisplayHid(ctx.Config)}`) *verbatim*."); // If the user confirms the deletion, export their system and send them the export file before actually // deleting their system, unless they specifically tell us not to do an export. - - var noExport = ctx.MatchFlag("ne", "no-export"); if (!noExport) { var json = await ctx.BusyIndicator(async () => diff --git a/PluralKit.Bot/Utils/ContextUtils.cs b/PluralKit.Bot/Utils/ContextUtils.cs index 79b94c3a..ce353472 100644 --- a/PluralKit.Bot/Utils/ContextUtils.cs +++ b/PluralKit.Bot/Utils/ContextUtils.cs @@ -55,7 +55,7 @@ public static class ContextUtils .WaitFor(ReactionPredicate, timeout); } - public static async Task ConfirmWithReply(this Context ctx, string expectedReply) + public static async Task ConfirmWithReply(this Context ctx, string expectedReply, bool treatAsHid = false) { bool Predicate(MessageCreateEvent e) => e.Author.Id == ctx.Author.Id && e.ChannelId == ctx.Channel.Id; @@ -63,7 +63,11 @@ public static class ContextUtils var msg = await ctx.Services.Resolve>() .WaitFor(Predicate, Duration.FromMinutes(1)); - return string.Equals(msg.Content, expectedReply, StringComparison.InvariantCultureIgnoreCase); + var content = msg.Content; + if (treatAsHid) + content = content.ToLower().Replace("-", null); + + return string.Equals(content, expectedReply, StringComparison.InvariantCultureIgnoreCase); } public static async Task Paginate(this Context ctx, IAsyncEnumerable items, int totalCount,