mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: implement system delete command
This commit is contained in:
parent
9e74835e4b
commit
047bdd870d
4 changed files with 19 additions and 12 deletions
|
|
@ -95,6 +95,7 @@ public partial class CommandTree
|
|||
Commands.SystemShowBanner(var param, var flags) => ctx.Execute<SystemEdit>(SystemBannerImage, m => m.ShowBannerImage(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.SystemClearBanner(var param, var flags) => ctx.Execute<SystemEdit>(SystemBannerImage, m => m.ClearBannerImage(ctx, ctx.System, flags.yes)),
|
||||
Commands.SystemChangeBanner(var param, _) => ctx.Execute<SystemEdit>(SystemBannerImage, m => m.ChangeBannerImage(ctx, ctx.System, param.banner)),
|
||||
Commands.SystemDelete(_, var flags) => ctx.Execute<SystemEdit>(SystemDelete, m => m.Delete(ctx, ctx.System, flags.no_export)),
|
||||
_ =>
|
||||
// this should only ever occur when deving if commands are not implemented...
|
||||
ctx.Reply(
|
||||
|
|
@ -364,8 +365,6 @@ public partial class CommandTree
|
|||
await ctx.CheckSystem(target).Execute<Groups>(GroupList, g => g.ListSystemGroups(ctx, target));
|
||||
else if (ctx.Match("privacy"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemPrivacy, m => m.SystemPrivacy(ctx, target));
|
||||
else if (ctx.Match("delete", "remove", "destroy", "erase", "yeet"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemDelete, m => m.Delete(ctx, target));
|
||||
else if (ctx.Match("id"))
|
||||
await ctx.CheckSystem(target).Execute<System>(SystemId, m => m.DisplayId(ctx, target));
|
||||
else if (ctx.Match("random", "rand", "r"))
|
||||
|
|
|
|||
|
|
@ -774,10 +774,9 @@ public class SystemEdit
|
|||
: ctx.Reply(msg));
|
||||
}
|
||||
|
||||
public async Task Delete(Context ctx, PKSystem target)
|
||||
public async Task Delete(Context ctx, PKSystem target, bool noExport)
|
||||
{
|
||||
ctx.CheckSystem().CheckOwnSystem(target);
|
||||
var noExport = ctx.MatchFlag("ne", "no-export");
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue