mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Add own member checks back to the avatar mutators
This commit is contained in:
parent
f1b28b7fb6
commit
0bb8d2b917
1 changed files with 3 additions and 0 deletions
|
|
@ -70,6 +70,7 @@ namespace PluralKit.Bot
|
|||
|
||||
private async Task AvatarFromUser(AvatarLocation location, Context ctx, PKMember target, DiscordUser user)
|
||||
{
|
||||
ctx.CheckSystem().CheckOwnMember(target);
|
||||
if (user.AvatarHash == null) throw Errors.UserHasNoAvatar;
|
||||
|
||||
var url = user.GetAvatarUrl(ImageFormat.Png, 256);
|
||||
|
|
@ -84,6 +85,7 @@ namespace PluralKit.Bot
|
|||
|
||||
private async Task AvatarFromArg(AvatarLocation location, Context ctx, PKMember target, string url)
|
||||
{
|
||||
ctx.CheckSystem().CheckOwnMember(target);
|
||||
if (url.Length > Limits.MaxUriLength) throw Errors.InvalidUrl(url);
|
||||
await AvatarUtils.VerifyAvatarOrThrow(url);
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ namespace PluralKit.Bot
|
|||
|
||||
private async Task AvatarFromAttachment(AvatarLocation location, Context ctx, PKMember target, DiscordAttachment attachment)
|
||||
{
|
||||
ctx.CheckSystem().CheckOwnMember(target);
|
||||
await AvatarUtils.VerifyAvatarOrThrow(attachment.Url);
|
||||
await UpdateAvatar(location, ctx, target, attachment.Url);
|
||||
if (location == AvatarLocation.Server)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue