mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-05 05:17:54 +00:00
feat(bot): add system guild icon & guild name (#554)
This commit is contained in:
parent
d12cd481f6
commit
3045c5e307
22 changed files with 337 additions and 28 deletions
|
|
@ -46,6 +46,8 @@ public class PKSystem
|
|||
public string WebhookUrl { get; }
|
||||
public string WebhookToken { get; }
|
||||
public Instant Created { get; }
|
||||
public PrivacyLevel NamePrivacy { get; }
|
||||
public PrivacyLevel AvatarPrivacy { get; }
|
||||
public PrivacyLevel DescriptionPrivacy { get; }
|
||||
public PrivacyLevel MemberListPrivacy { get; }
|
||||
public PrivacyLevel FrontPrivacy { get; }
|
||||
|
|
@ -59,18 +61,24 @@ public static class PKSystemExt
|
|||
public static string DescriptionFor(this PKSystem system, LookupContext ctx) =>
|
||||
system.DescriptionPrivacy.Get(ctx, system.Description);
|
||||
|
||||
public static string NameFor(this PKSystem system, LookupContext ctx) =>
|
||||
system.NamePrivacy.Get(ctx, system.Name);
|
||||
|
||||
public static string AvatarFor(this PKSystem system, LookupContext ctx) =>
|
||||
system.AvatarPrivacy.Get(ctx, system.AvatarUrl.TryGetCleanCdnUrl());
|
||||
|
||||
public static JObject ToJson(this PKSystem system, LookupContext ctx)
|
||||
{
|
||||
var o = new JObject();
|
||||
o.Add("id", system.Hid);
|
||||
o.Add("uuid", system.Uuid.ToString());
|
||||
|
||||
o.Add("name", system.Name);
|
||||
o.Add("name", system.NameFor(ctx));
|
||||
o.Add("description", system.DescriptionFor(ctx));
|
||||
o.Add("tag", system.Tag);
|
||||
o.Add("pronouns", system.PronounPrivacy.Get(ctx, system.Pronouns));
|
||||
|
||||
o.Add("avatar_url", system.AvatarUrl.TryGetCleanCdnUrl());
|
||||
o.Add("avatar_url", system.AvatarFor(ctx));
|
||||
o.Add("banner", system.DescriptionPrivacy.Get(ctx, system.BannerImage).TryGetCleanCdnUrl());
|
||||
o.Add("color", system.Color);
|
||||
o.Add("created", system.Created.FormatExport());
|
||||
|
|
@ -83,6 +91,8 @@ public static class PKSystemExt
|
|||
|
||||
var p = new JObject();
|
||||
|
||||
p.Add("name_privacy", system.NamePrivacy.ToJsonString());
|
||||
p.Add("avatar_privacy", system.AvatarPrivacy.ToJsonString());
|
||||
p.Add("description_privacy", system.DescriptionPrivacy.ToJsonString());
|
||||
p.Add("pronoun_privacy", system.PronounPrivacy.ToJsonString());
|
||||
p.Add("member_list_privacy", system.MemberListPrivacy.ToJsonString());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue