mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-05 05:17:54 +00:00
add missing confirms to command handlers and -yes flags to the definitions
This commit is contained in:
parent
12655fb539
commit
498d657cd4
3 changed files with 19 additions and 6 deletions
|
|
@ -237,10 +237,10 @@ public partial class CommandTree
|
|||
Commands.GroupClearName(var param, var flags) => ctx.Execute<Groups>(GroupRename, g => g.RenameGroup(ctx, param.target, null)),
|
||||
Commands.GroupRename(var param, var flags) => ctx.Execute<Groups>(GroupRename, g => g.RenameGroup(ctx, param.target, param.name, flags.yes)),
|
||||
Commands.GroupShowDisplayName(var param, var flags) => ctx.Execute<Groups>(GroupDisplayName, g => g.ShowGroupDisplayName(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.GroupClearDisplayName(var param, var flags) => ctx.Execute<Groups>(GroupDisplayName, g => g.ClearGroupDisplayName(ctx, param.target)),
|
||||
Commands.GroupClearDisplayName(var param, var flags) => ctx.Execute<Groups>(GroupDisplayName, g => g.ClearGroupDisplayName(ctx, param.target, flags.yes)),
|
||||
Commands.GroupChangeDisplayName(var param, _) => ctx.Execute<Groups>(GroupDisplayName, g => g.ChangeGroupDisplayName(ctx, param.target, param.name)),
|
||||
Commands.GroupShowDescription(var param, var flags) => ctx.Execute<Groups>(GroupDesc, g => g.ShowGroupDescription(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.GroupClearDescription(var param, var flags) => ctx.Execute<Groups>(GroupDesc, g => g.ClearGroupDescription(ctx, param.target)),
|
||||
Commands.GroupClearDescription(var param, var flags) => ctx.Execute<Groups>(GroupDesc, g => g.ClearGroupDescription(ctx, param.target, flags.yes)),
|
||||
Commands.GroupChangeDescription(var param, _) => ctx.Execute<Groups>(GroupDesc, g => g.ChangeGroupDescription(ctx, param.target, param.description)),
|
||||
Commands.GroupShowIcon(var param, var flags) => ctx.Execute<Groups>(GroupIcon, g => g.ShowGroupIcon(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.GroupClearIcon(var param, var flags) => ctx.Execute<Groups>(GroupIcon, g => g.ClearGroupIcon(ctx, param.target, flags.yes)),
|
||||
|
|
@ -249,7 +249,7 @@ public partial class CommandTree
|
|||
Commands.GroupClearBanner(var param, var flags) => ctx.Execute<Groups>(GroupBannerImage, g => g.ClearGroupBanner(ctx, param.target, flags.yes)),
|
||||
Commands.GroupChangeBanner(var param, _) => ctx.Execute<Groups>(GroupBannerImage, g => g.ChangeGroupBanner(ctx, param.target, param.banner)),
|
||||
Commands.GroupShowColor(var param, var flags) => ctx.Execute<Groups>(GroupColor, g => g.ShowGroupColor(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.GroupClearColor(var param, var flags) => ctx.Execute<Groups>(GroupColor, g => g.ClearGroupColor(ctx, param.target)),
|
||||
Commands.GroupClearColor(var param, var flags) => ctx.Execute<Groups>(GroupColor, g => g.ClearGroupColor(ctx, param.target, flags.yes)),
|
||||
Commands.GroupChangeColor(var param, _) => ctx.Execute<Groups>(GroupColor, g => g.ChangeGroupColor(ctx, param.target, param.color)),
|
||||
Commands.GroupAddMember(var param, var flags) => ctx.Execute<GroupMember>(GroupAdd, g => g.AddRemoveMembers(ctx, param.target, param.targets, Groups.AddRemoveOperation.Add, flags.all)),
|
||||
Commands.GroupRemoveMember(var param, var flags) => ctx.Execute<GroupMember>(GroupRemove, g => g.AddRemoveMembers(ctx, param.target, param.targets, Groups.AddRemoveOperation.Remove, flags.all, flags.yes)),
|
||||
|
|
|
|||
|
|
@ -174,10 +174,13 @@ public class Groups
|
|||
await ctx.Reply(embed: eb2.Build());
|
||||
}
|
||||
|
||||
public async Task ClearGroupDisplayName(Context ctx, PKGroup target)
|
||||
public async Task ClearGroupDisplayName(Context ctx, PKGroup target, bool confirmYes = false)
|
||||
{
|
||||
ctx.CheckOwnGroup(target);
|
||||
|
||||
if (!await ctx.ConfirmClear("this group's display name", confirmYes))
|
||||
return;
|
||||
|
||||
var patch = new GroupPatch { DisplayName = Partial<string>.Null() };
|
||||
await ctx.Repository.UpdateGroup(target.Id, patch);
|
||||
|
||||
|
|
@ -253,10 +256,13 @@ public class Groups
|
|||
await ctx.Reply(embed: eb2.Build());
|
||||
}
|
||||
|
||||
public async Task ClearGroupDescription(Context ctx, PKGroup target)
|
||||
public async Task ClearGroupDescription(Context ctx, PKGroup target, bool confirmYes = false)
|
||||
{
|
||||
ctx.CheckOwnGroup(target);
|
||||
|
||||
if (!await ctx.ConfirmClear("this group's description", confirmYes))
|
||||
return;
|
||||
|
||||
var patch = new GroupPatch { Description = Partial<string>.Null() };
|
||||
await ctx.Repository.UpdateGroup(target.Id, patch);
|
||||
|
||||
|
|
@ -479,10 +485,13 @@ public class Groups
|
|||
await ctx.Reply(embed: eb.Build(), files: [MiscUtils.GenerateColorPreview(target.Color)]);
|
||||
}
|
||||
|
||||
public async Task ClearGroupColor(Context ctx, PKGroup target)
|
||||
public async Task ClearGroupColor(Context ctx, PKGroup target, bool confirmYes = false)
|
||||
{
|
||||
ctx.CheckOwnGroup(target);
|
||||
|
||||
if (!await ctx.ConfirmClear("this group's color", confirmYes))
|
||||
return;
|
||||
|
||||
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { Color = Partial<string>.Null() });
|
||||
|
||||
await ctx.Reply($"{Emojis.Success} Group color cleared.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue