mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): make deletion ID checks accept hyphens/caps
This commit is contained in:
parent
eccab602d5
commit
7965e15282
4 changed files with 20 additions and 15 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 () =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue