mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix: respect system avatar privacy
This commit is contained in:
parent
fa9e88c846
commit
bba86fe98b
1 changed files with 18 additions and 3 deletions
|
|
@ -567,6 +567,9 @@ public class SystemEdit
|
|||
async Task ShowIcon()
|
||||
{
|
||||
if ((target.AvatarUrl?.Trim() ?? "").Length > 0)
|
||||
{
|
||||
if (!target.AvatarPrivacy.CanAccess(ctx.DirectLookupContextFor(target.Id)))
|
||||
throw new PKSyntaxError("This system does not have an icon set or it is private.");
|
||||
switch (ctx.MatchFormat())
|
||||
{
|
||||
case ReplyFormat.Raw:
|
||||
|
|
@ -586,9 +589,14 @@ public class SystemEdit
|
|||
await ctx.Reply(embed: ebS.Build());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var isOwner = target.Id == ctx.System?.Id;
|
||||
throw new PKSyntaxError(
|
||||
"This system does not have an icon set. Set one by attaching an image to this command, or by passing an image URL or @mention.");
|
||||
$"This system does not have an icon set{(isOwner ? "" : " or it is private")}."
|
||||
+ (isOwner ? " Set one by attaching an image to this command, or by passing an image URL or @mention." : ""));
|
||||
}
|
||||
}
|
||||
|
||||
if (target != null && target?.Id != ctx.System?.Id)
|
||||
|
|
@ -646,10 +654,12 @@ public class SystemEdit
|
|||
|
||||
async Task ShowIcon()
|
||||
{
|
||||
|
||||
var settings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, target.Id);
|
||||
|
||||
if ((settings.AvatarUrl?.Trim() ?? "").Length > 0)
|
||||
{
|
||||
if (!target.AvatarPrivacy.CanAccess(ctx.DirectLookupContextFor(target.Id)))
|
||||
throw new PKSyntaxError("This system does not have a icon specific to this server or it is private.");
|
||||
switch (ctx.MatchFormat())
|
||||
{
|
||||
case ReplyFormat.Raw:
|
||||
|
|
@ -669,9 +679,14 @@ public class SystemEdit
|
|||
await ctx.Reply(embed: ebS.Build());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var isOwner = target.Id == ctx.System?.Id;
|
||||
throw new PKSyntaxError(
|
||||
"This system does not have a icon specific to this server. Set one by attaching an image to this command, or by passing an image URL or @mention.");
|
||||
$"This system does not have a icon specific to this server{(isOwner ? "" : " or it is private")}."
|
||||
+ (isOwner ? " Set one by attaching an image to this command, or by passing an image URL or @mention." : ""));
|
||||
}
|
||||
}
|
||||
|
||||
ctx.CheckGuildContext();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue