mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 09:10:14 +00:00
fix: inconsistent behavior with non-owned banner lookups
This commit is contained in:
parent
83d1a08aaf
commit
8e1b962c4b
1 changed files with 5 additions and 3 deletions
|
|
@ -194,16 +194,18 @@ public class MemberEdit
|
||||||
|
|
||||||
public async Task BannerImage(Context ctx, PKMember target)
|
public async Task BannerImage(Context ctx, PKMember target)
|
||||||
{
|
{
|
||||||
ctx.CheckOwnMember(target);
|
|
||||||
|
|
||||||
async Task ClearBannerImage()
|
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.Repository.UpdateMember(target.Id, new MemberPatch { BannerImage = null });
|
||||||
await ctx.Reply($"{Emojis.Success} Member banner image cleared.");
|
await ctx.Reply($"{Emojis.Success} Member banner image cleared.");
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task SetBannerImage(ParsedImage img)
|
async Task SetBannerImage(ParsedImage img)
|
||||||
{
|
{
|
||||||
|
ctx.CheckOwnMember(target);
|
||||||
img = await _avatarHosting.TryRehostImage(img, AvatarHostingService.RehostedImageType.Banner, ctx.Author.Id, ctx.System);
|
img = await _avatarHosting.TryRehostImage(img, AvatarHostingService.RehostedImageType.Banner, ctx.Author.Id, ctx.System);
|
||||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
|
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
|
||||||
|
|
||||||
|
|
@ -243,7 +245,7 @@ public class MemberEdit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.MatchClear() && await ctx.ConfirmClear("this member's banner image"))
|
if (ctx.MatchClear())
|
||||||
await ClearBannerImage();
|
await ClearBannerImage();
|
||||||
else if (await ctx.MatchImage() is { } img)
|
else if (await ctx.MatchImage() is { } img)
|
||||||
await SetBannerImage(img);
|
await SetBannerImage(img);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue