fix(bot): check own system before confirming clear in a few commands

This commit is contained in:
alyssa 2024-11-10 11:03:18 +09:00
parent 614131265b
commit 620364bf61
2 changed files with 6 additions and 3 deletions

View file

@ -273,6 +273,7 @@ public class Groups
{
async Task ClearIcon()
{
await ctx.ConfirmClear("this group's icon");
ctx.CheckOwnGroup(target);
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { Icon = null });
@ -328,7 +329,7 @@ public class Groups
}
}
if (ctx.MatchClear() && await ctx.ConfirmClear("this group's icon"))
if (ctx.MatchClear())
await ClearIcon();
else if (await ctx.MatchImage() is { } img)
await SetIcon(img);
@ -340,6 +341,7 @@ public class Groups
{
async Task ClearBannerImage()
{
await ctx.ConfirmClear("this group's banner image");
ctx.CheckOwnGroup(target);
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { BannerImage = null });
@ -394,7 +396,7 @@ public class Groups
}
}
if (ctx.MatchClear() && await ctx.ConfirmClear("this group's banner image"))
if (ctx.MatchClear())
await ClearBannerImage();
else if (await ctx.MatchImage() is { } img)
await SetBannerImage(img);

View file

@ -123,9 +123,10 @@ public class MemberAvatar
MemberGuildSettings? guildData)
{
// First, see if we need to *clear*
if (ctx.MatchClear() && await ctx.ConfirmClear("this member's " + location.Name()))
if (ctx.MatchClear())
{
ctx.CheckSystem().CheckOwnMember(target);
await ctx.ConfirmClear("this member's " + location.Name());
await AvatarClear(location, ctx, target, guildData);
return;
}