fix: inconsistent behavior with non-owned banner lookups

This commit is contained in:
rladenson 2024-11-18 00:43:49 -07:00 committed by Petal Ladenson
parent ceeac24296
commit 562afcdb8a

View file

@ -194,16 +194,18 @@ public class MemberEdit
public async Task BannerImage(Context ctx, PKMember target)
{
ctx.CheckOwnMember(target);
async Task ClearBannerImage()
{
ctx.CheckOwnMember(target);
await ctx.ConfirmClear("this member's banner image");
await ctx.Repository.UpdateMember(target.Id, new MemberPatch { BannerImage = null });
await ctx.Reply($"{Emojis.Success} Member banner image cleared.");
}
async Task SetBannerImage(ParsedImage img)
{
ctx.CheckOwnMember(target);
img = await _avatarHosting.TryRehostImage(img, AvatarHostingService.RehostedImageType.Banner, ctx.Author.Id, ctx.System);
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
@ -253,7 +255,7 @@ public class MemberEdit
"This member does not have a banner image set." + ((target.System == ctx.System?.Id) ? " Set one by attaching an image to this command, or by passing an image URL." : ""));
}
if (ctx.MatchClear() && await ctx.ConfirmClear("this member's banner image"))
if (ctx.MatchClear())
await ClearBannerImage();
else if (await ctx.MatchImage() is { } img)
await SetBannerImage(img);