fix: show correct name in entityReference when base name is private
This commit is contained in:
parent
47e501da81
commit
375758206e
@ -71,10 +71,10 @@ public class GroupMember
|
||||
if (pctx == LookupContext.ByOwner)
|
||||
{
|
||||
msg +=
|
||||
$"\n\nTo add this member to one or more groups, use `pk;m {target.Reference()} group add <group> [group 2] [group 3...]`";
|
||||
$"\n\nTo add this member to one or more groups, use `pk;m {target.Reference(ctx)} group add <group> [group 2] [group 3...]`";
|
||||
if (groups.Count > 0)
|
||||
msg +=
|
||||
$"\nTo remove this member from one or more groups, use `pk;m {target.Reference()} group remove <group> [group 2] [group 3...]`";
|
||||
$"\nTo remove this member from one or more groups, use `pk;m {target.Reference(ctx)} group remove <group> [group 2] [group 3...]`";
|
||||
}
|
||||
|
||||
await ctx.Reply(msg, new EmbedBuilder().Title($"{target.Name}'s groups").Description(description).Build());
|
||||
|
@ -81,16 +81,18 @@ public class Groups
|
||||
EventData = dispatchData
|
||||
});
|
||||
|
||||
var reference = newGroup.Reference(ctx);
|
||||
|
||||
var eb = new EmbedBuilder()
|
||||
.Description(
|
||||
$"Your new group, **{groupName}**, has been created, with the group ID **`{newGroup.Hid}`**.\nBelow are a couple of useful commands:")
|
||||
.Field(new Embed.Field("View the group card", $"> pk;group **{newGroup.Reference()}**"))
|
||||
.Field(new Embed.Field("View the group card", $"> pk;group **{reference}**"))
|
||||
.Field(new Embed.Field("Add members to the group",
|
||||
$"> pk;group **{newGroup.Reference()}** add **MemberName**\n> pk;group **{newGroup.Reference()}** add **Member1** **Member2** **Member3** (and so on...)"))
|
||||
$"> pk;group **{reference}** add **MemberName**\n> pk;group **{reference}** add **Member1** **Member2** **Member3** (and so on...)"))
|
||||
.Field(new Embed.Field("Set the description",
|
||||
$"> pk;group **{newGroup.Reference()}** description **This is my new group, and here is the description!**"))
|
||||
$"> pk;group **{reference}** description **This is my new group, and here is the description!**"))
|
||||
.Field(new Embed.Field("Set the group icon",
|
||||
$"> pk;group **{newGroup.Reference()}** icon\n*(with an image attached)*"));
|
||||
$"> pk;group **{reference}** icon\n*(with an image attached)*"));
|
||||
await ctx.Reply($"{Emojis.Success} Group created!", eb.Build());
|
||||
|
||||
if (existingGroupCount >= Limits.WarnThreshold(groupLimit))
|
||||
@ -128,7 +130,7 @@ public class Groups
|
||||
var noDisplayNameSetMessage = "This group does not have a display name set.";
|
||||
if (ctx.System?.Id == target.System)
|
||||
noDisplayNameSetMessage +=
|
||||
$" To set one, type `pk;group {target.Reference()} displayname <display name>`.";
|
||||
$" To set one, type `pk;group {target.Reference(ctx)} displayname <display name>`.";
|
||||
|
||||
// No perms check, display name isn't covered by member privacy
|
||||
|
||||
@ -153,11 +155,13 @@ public class Groups
|
||||
.Field(new Embed.Field("Name", target.Name))
|
||||
.Field(new Embed.Field("Display Name", target.DisplayName));
|
||||
|
||||
var reference = target.Reference(ctx);
|
||||
|
||||
if (ctx.System?.Id == target.System)
|
||||
eb.Description(
|
||||
$"To change display name, type `pk;group {target.Reference()} displayname <display name>`."
|
||||
+ $"To clear it, type `pk;group {target.Reference()} displayname -clear`."
|
||||
+ $"To print the raw display name, type `pk;group {target.Reference()} displayname -raw`.");
|
||||
$"To change display name, type `pk;group {reference} displayname <display name>`."
|
||||
+ $"To clear it, type `pk;group {reference} displayname -clear`."
|
||||
+ $"To print the raw display name, type `pk;group {reference} displayname -raw`.");
|
||||
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
}
|
||||
@ -194,7 +198,7 @@ public class Groups
|
||||
var noDescriptionSetMessage = "This group does not have a description set.";
|
||||
if (ctx.System?.Id == target.System)
|
||||
noDescriptionSetMessage +=
|
||||
$" To set one, type `pk;group {target.Reference()} description <description>`.";
|
||||
$" To set one, type `pk;group {target.Reference(ctx)} description <description>`.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
@ -214,9 +218,9 @@ public class Groups
|
||||
.Title("Group description")
|
||||
.Description(target.Description)
|
||||
.Field(new Embed.Field("\u200B",
|
||||
$"To print the description with formatting, type `pk;group {target.Reference()} description -raw`."
|
||||
$"To print the description with formatting, type `pk;group {target.Reference(ctx)} description -raw`."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To clear it, type `pk;group {target.Reference()} description -clear`."
|
||||
? $" To clear it, type `pk;group {target.Reference(ctx)} description -clear`."
|
||||
: "")))
|
||||
.Build());
|
||||
return;
|
||||
@ -289,7 +293,7 @@ public class Groups
|
||||
.Image(new Embed.EmbedImage(target.Icon.TryGetCleanCdnUrl()));
|
||||
|
||||
if (target.System == ctx.System?.Id)
|
||||
eb.Description($"To clear, use `pk;group {target.Reference()} icon -clear`.");
|
||||
eb.Description($"To clear, use `pk;group {target.Reference(ctx)} icon -clear`.");
|
||||
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
}
|
||||
@ -353,7 +357,7 @@ public class Groups
|
||||
.Image(new Embed.EmbedImage(target.BannerImage));
|
||||
|
||||
if (target.System == ctx.System?.Id)
|
||||
eb.Description($"To clear, use `pk;group {target.Reference()} banner clear`.");
|
||||
eb.Description($"To clear, use `pk;group {target.Reference(ctx)} banner clear`.");
|
||||
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
}
|
||||
@ -389,7 +393,7 @@ public class Groups
|
||||
if (target.Color == null)
|
||||
if (ctx.System?.Id == target.System)
|
||||
await ctx.Reply(
|
||||
$"This group does not have a color set. To set one, type `pk;group {target.Reference()} color <color>`.");
|
||||
$"This group does not have a color set. To set one, type `pk;group {target.Reference(ctx)} color <color>`.");
|
||||
else
|
||||
await ctx.Reply("This group does not have a color set.");
|
||||
else
|
||||
@ -399,7 +403,7 @@ public class Groups
|
||||
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{target.Color}/?text=%20"))
|
||||
.Description($"This group's color is **#{target.Color}**."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To clear it, type `pk;group {target.Reference()} color -clear`."
|
||||
? $" To clear it, type `pk;group {target.Reference(ctx)} color -clear`."
|
||||
: ""))
|
||||
.Build());
|
||||
}
|
||||
@ -481,7 +485,7 @@ public class Groups
|
||||
.Field(new Embed.Field("Metadata (creation date)", target.MetadataPrivacy.Explanation()))
|
||||
.Field(new Embed.Field("Visibility", target.Visibility.Explanation()))
|
||||
.Description(
|
||||
$"To edit privacy settings, use the command:\n> pk;group **{target.Reference()}** privacy **<subject>** **<level>**\n\n- `subject` is one of `name`, `description`, `icon`, `members`, `metadata`, `visibility`, or `all`\n- `level` is either `public` or `private`.")
|
||||
$"To edit privacy settings, use the command:\n> pk;group **{target.Reference(ctx)}** privacy **<subject>** **<level>**\n\n- `subject` is one of `name`, `description`, `icon`, `members`, `metadata`, `visibility`, or `all`\n- `level` is either `public` or `private`.")
|
||||
.Build());
|
||||
return;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class MemberAvatar
|
||||
{
|
||||
if (mgs?.AvatarUrl != null)
|
||||
await ctx.Reply(
|
||||
$"{Emojis.Success} Member avatar cleared. Note that this member has a server-specific avatar set here, type `pk;member {target.Reference()} serveravatar clear` if you wish to clear that too.");
|
||||
$"{Emojis.Success} Member avatar cleared. Note that this member has a server-specific avatar set here, type `pk;member {target.Reference(ctx)} serveravatar clear` if you wish to clear that too.");
|
||||
else
|
||||
await ctx.Reply($"{Emojis.Success} Member avatar cleared.");
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class MemberAvatar
|
||||
|
||||
if (location == AvatarLocation.Server)
|
||||
throw new PKError(
|
||||
$"This member does not have a server avatar set. Type `pk;member {target.Reference()} avatar` to see their global avatar.");
|
||||
$"This member does not have a server avatar set. Type `pk;member {target.Reference(ctx)} avatar` to see their global avatar.");
|
||||
}
|
||||
|
||||
var field = location == AvatarLocation.Server ? $"server avatar (for {ctx.Guild.Name})" : "avatar";
|
||||
@ -67,7 +67,7 @@ public class MemberAvatar
|
||||
.Title($"{target.NameFor(ctx)}'s {field}")
|
||||
.Image(new Embed.EmbedImage(currentValue?.TryGetCleanCdnUrl()));
|
||||
if (target.System == ctx.System?.Id)
|
||||
eb.Description($"To clear, use `pk;member {target.Reference()} {cmd} clear`.");
|
||||
eb.Description($"To clear, use `pk;member {target.Reference(ctx)} {cmd} clear`.");
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class MemberEdit
|
||||
var noDescriptionSetMessage = "This member does not have a description set.";
|
||||
if (ctx.System?.Id == target.System)
|
||||
noDescriptionSetMessage +=
|
||||
$" To set one, type `pk;member {target.Reference()} description <description>`.";
|
||||
$" To set one, type `pk;member {target.Reference(ctx)} description <description>`.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
@ -86,9 +86,9 @@ public class MemberEdit
|
||||
.Title("Member description")
|
||||
.Description(target.Description)
|
||||
.Field(new Embed.Field("\u200B",
|
||||
$"To print the description with formatting, type `pk;member {target.Reference()} description -raw`."
|
||||
$"To print the description with formatting, type `pk;member {target.Reference(ctx)} description -raw`."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To clear it, type `pk;member {target.Reference()} description -clear`."
|
||||
? $" To clear it, type `pk;member {target.Reference(ctx)} description -clear`."
|
||||
: "")))
|
||||
.Build());
|
||||
return;
|
||||
@ -119,7 +119,7 @@ public class MemberEdit
|
||||
{
|
||||
var noPronounsSetMessage = "This member does not have pronouns set.";
|
||||
if (ctx.System?.Id == target.System)
|
||||
noPronounsSetMessage += $"To set some, type `pk;member {target.Reference()} pronouns <pronouns>`.";
|
||||
noPronounsSetMessage += $"To set some, type `pk;member {target.Reference(ctx)} pronouns <pronouns>`.";
|
||||
|
||||
ctx.CheckSystemPrivacy(target.System, target.PronounPrivacy);
|
||||
|
||||
@ -138,9 +138,9 @@ public class MemberEdit
|
||||
await ctx.Reply(noPronounsSetMessage);
|
||||
else
|
||||
await ctx.Reply(
|
||||
$"**{target.NameFor(ctx)}**'s pronouns are **{target.Pronouns}**.\nTo print the pronouns with formatting, type `pk;member {target.Reference()} pronouns -raw`."
|
||||
$"**{target.NameFor(ctx)}**'s pronouns are **{target.Pronouns}**.\nTo print the pronouns with formatting, type `pk;member {target.Reference(ctx)} pronouns -raw`."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To clear them, type `pk;member {target.Reference()} pronouns -clear`."
|
||||
? $" To clear them, type `pk;member {target.Reference(ctx)} pronouns -clear`."
|
||||
: ""));
|
||||
return;
|
||||
}
|
||||
@ -243,7 +243,7 @@ public class MemberEdit
|
||||
if (target.Color == null)
|
||||
if (ctx.System?.Id == target.System)
|
||||
await ctx.Reply(
|
||||
$"This member does not have a color set. To set one, type `pk;member {target.Reference()} color <color>`.");
|
||||
$"This member does not have a color set. To set one, type `pk;member {target.Reference(ctx)} color <color>`.");
|
||||
else
|
||||
await ctx.Reply("This member does not have a color set.");
|
||||
else
|
||||
@ -253,7 +253,7 @@ public class MemberEdit
|
||||
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{target.Color}/?text=%20"))
|
||||
.Description($"This member's color is **#{target.Color}**."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To clear it, type `pk;member {target.Reference()} color -clear`."
|
||||
? $" To clear it, type `pk;member {target.Reference(ctx)} color -clear`."
|
||||
: ""))
|
||||
.Build());
|
||||
}
|
||||
@ -293,12 +293,12 @@ public class MemberEdit
|
||||
if (target.Birthday == null)
|
||||
await ctx.Reply("This member does not have a birthdate set."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To set one, type `pk;member {target.Reference()} birthdate <birthdate>`."
|
||||
? $" To set one, type `pk;member {target.Reference(ctx)} birthdate <birthdate>`."
|
||||
: ""));
|
||||
else
|
||||
await ctx.Reply($"This member's birthdate is **{target.BirthdayString}**."
|
||||
+ (ctx.System?.Id == target.System
|
||||
? $" To clear it, type `pk;member {target.Reference()} birthdate -clear`."
|
||||
? $" To clear it, type `pk;member {target.Reference(ctx)} birthdate -clear`."
|
||||
: ""));
|
||||
}
|
||||
else
|
||||
@ -322,6 +322,7 @@ public class MemberEdit
|
||||
}
|
||||
}
|
||||
|
||||
private string boldIf(string str, bool condition) => condition ? $"**{str}**" : str;
|
||||
private async Task<EmbedBuilder> CreateMemberNameInfoEmbed(Context ctx, PKMember target)
|
||||
{
|
||||
var lcx = ctx.LookupContextFor(target.System);
|
||||
@ -335,28 +336,25 @@ public class MemberEdit
|
||||
.Footer(new Embed.EmbedFooter(
|
||||
$"Member ID: {target.Hid} | Active name in bold. Server name overrides display name, which overrides base name."));
|
||||
|
||||
if (target.DisplayName == null && memberGuildConfig?.DisplayName == null)
|
||||
eb.Field(new Embed.Field("Name", $"**{target.NameFor(ctx)}**"));
|
||||
else
|
||||
eb.Field(new Embed.Field("Name", target.NameFor(ctx)));
|
||||
var showDisplayName = target.NamePrivacy.CanAccess(lcx);
|
||||
|
||||
if (target.NamePrivacy.CanAccess(lcx))
|
||||
{
|
||||
if (target.DisplayName != null && memberGuildConfig?.DisplayName == null)
|
||||
eb.Field(new Embed.Field("Display Name", $"**{target.DisplayName}**"));
|
||||
else
|
||||
eb.Field(new Embed.Field("Display Name", target.DisplayName ?? "*(none)*"));
|
||||
}
|
||||
eb.Field(new Embed.Field("Name", boldIf(
|
||||
target.NameFor(ctx),
|
||||
(!showDisplayName || target.DisplayName == null) && memberGuildConfig?.DisplayName == null
|
||||
)));
|
||||
|
||||
if (showDisplayName)
|
||||
eb.Field(new Embed.Field("Display name", target.DisplayName != null
|
||||
? boldIf(target.DisplayName, memberGuildConfig?.DisplayName == null)
|
||||
: "*(none)*"
|
||||
));
|
||||
|
||||
if (ctx.Guild != null)
|
||||
{
|
||||
if (memberGuildConfig?.DisplayName != null)
|
||||
eb.Field(new Embed.Field($"Server Name (in {ctx.Guild.Name})",
|
||||
$"**{memberGuildConfig.DisplayName}**"));
|
||||
else
|
||||
eb.Field(new Embed.Field($"Server Name (in {ctx.Guild.Name})",
|
||||
memberGuildConfig?.DisplayName ?? "*(none)*"));
|
||||
}
|
||||
memberGuildConfig?.DisplayName != null
|
||||
? $"**{memberGuildConfig.DisplayName}**"
|
||||
: "*(none)*"
|
||||
));
|
||||
|
||||
return eb;
|
||||
}
|
||||
@ -380,7 +378,7 @@ public class MemberEdit
|
||||
var noDisplayNameSetMessage = "This member does not have a display name set.";
|
||||
if (ctx.System?.Id == target.System)
|
||||
noDisplayNameSetMessage +=
|
||||
$" To set one, type `pk;member {target.Reference()} displayname <display name>`.";
|
||||
$" To set one, type `pk;member {target.Reference(ctx)} displayname <display name>`.";
|
||||
|
||||
// No perms check, display name isn't covered by member privacy
|
||||
|
||||
@ -396,11 +394,12 @@ public class MemberEdit
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
var eb = await CreateMemberNameInfoEmbed(ctx, target);
|
||||
var reference = target.Reference(ctx);
|
||||
if (ctx.System?.Id == target.System)
|
||||
eb.Description(
|
||||
$"To change display name, type `pk;member {target.Reference()} displayname <display name>`."
|
||||
+ $"To clear it, type `pk;member {target.Reference()} displayname -clear`."
|
||||
+ $"To print the raw display name, type `pk;member {target.Reference()} displayname -raw`.");
|
||||
$"To change display name, type `pk;member {reference} displayname <display name>`."
|
||||
+ $"To clear it, type `pk;member {reference} displayname -clear`."
|
||||
+ $"To print the raw display name, type `pk;member {reference} displayname -raw`.");
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
@ -437,7 +436,7 @@ public class MemberEdit
|
||||
var noServerNameSetMessage = "This member does not have a server name set.";
|
||||
if (ctx.System?.Id == target.System)
|
||||
noServerNameSetMessage +=
|
||||
$" To set one, type `pk;member {target.Reference()} servername <server name>`.";
|
||||
$" To set one, type `pk;member {target.Reference(ctx)} servername <server name>`.";
|
||||
|
||||
// No perms check, display name isn't covered by member privacy
|
||||
var memberGuildConfig = await ctx.Repository.GetMemberGuild(ctx.Guild.Id, target.Id);
|
||||
@ -454,9 +453,10 @@ public class MemberEdit
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
var eb = await CreateMemberNameInfoEmbed(ctx, target);
|
||||
var reference = target.Reference(ctx);
|
||||
if (ctx.System?.Id == target.System)
|
||||
eb.Description(
|
||||
$"To change server name, type `pk;member {target.Reference()} servername <server name>`.\nTo clear it, type `pk;member {target.Reference()} servername -clear`.\nTo print the raw server name, type `pk;member {target.Reference()} servername -raw`.");
|
||||
$"To change server name, type `pk;member {reference} servername <server name>`.\nTo clear it, type `pk;member {reference} servername -clear`.\nTo print the raw server name, type `pk;member {reference} servername -raw`.");
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
@ -658,7 +658,7 @@ public class MemberEdit
|
||||
if (subject == MemberPrivacySubject.Avatar && level == PrivacyLevel.Private &&
|
||||
guildSettings?.AvatarUrl == null)
|
||||
await ctx.Reply(
|
||||
$"{Emojis.Warn} This member does not have a server avatar set, so *proxying* will **still show the member avatar**. If you want to hide your avatar when proxying here, set a server avatar: `pk;member {target.Reference()} serveravatar`");
|
||||
$"{Emojis.Warn} This member does not have a server avatar set, so *proxying* will **still show the member avatar**. If you want to hide your avatar when proxying here, set a server avatar: `pk;member {target.Reference(ctx)} serveravatar`");
|
||||
}
|
||||
|
||||
if (ctx.Match("all") || newValueFromCommand != null)
|
||||
|
@ -64,7 +64,7 @@ public class MemberProxy
|
||||
throw new PKSyntaxError("You must pass an example proxy to add (eg. `[text]` or `J:text`).");
|
||||
|
||||
var tagToAdd = ParseProxyTags(ctx.RemainderOrNull(false));
|
||||
if (tagToAdd.IsEmpty) throw Errors.EmptyProxyTags(target);
|
||||
if (tagToAdd.IsEmpty) throw Errors.EmptyProxyTags(target, ctx);
|
||||
if (target.ProxyTags.Contains(tagToAdd))
|
||||
throw Errors.ProxyTagAlreadyExists(tagToAdd, target);
|
||||
if (tagToAdd.ProxyString.Length > Limits.MaxProxyTagLength)
|
||||
@ -88,7 +88,7 @@ public class MemberProxy
|
||||
throw new PKSyntaxError("You must pass a proxy tag to remove (eg. `[text]` or `J:text`).");
|
||||
|
||||
var tagToRemove = ParseProxyTags(ctx.RemainderOrNull(false));
|
||||
if (tagToRemove.IsEmpty) throw Errors.EmptyProxyTags(target);
|
||||
if (tagToRemove.IsEmpty) throw Errors.EmptyProxyTags(target, ctx);
|
||||
if (!target.ProxyTags.Contains(tagToRemove))
|
||||
throw Errors.ProxyTagDoesNotExist(tagToRemove, target);
|
||||
|
||||
@ -103,7 +103,7 @@ public class MemberProxy
|
||||
else
|
||||
{
|
||||
var requestedTag = ParseProxyTags(ctx.RemainderOrNull(false));
|
||||
if (requestedTag.IsEmpty) throw Errors.EmptyProxyTags(target);
|
||||
if (requestedTag.IsEmpty) throw Errors.EmptyProxyTags(target, ctx);
|
||||
|
||||
// This is mostly a legacy command, so it's gonna warn if there's
|
||||
// already more than one proxy tag.
|
||||
|
@ -170,11 +170,11 @@ public static class Errors
|
||||
public static PKError ProxyTagDoesNotExist(ProxyTag tagToRemove, PKMember member) => new(
|
||||
$"That member does not have the proxy tag {tagToRemove.ProxyString.AsCode()}. The member currently has these tags: {member.ProxyTagsString()}");
|
||||
|
||||
public static PKError LegacyAlreadyHasProxyTag(ProxyTag requested, PKMember member) => new(
|
||||
$"This member already has more than one proxy tag set: {member.ProxyTagsString()}\nConsider using the {$"pk;member {member.Reference()} proxy add {requested.ProxyString}".AsCode()} command instead.");
|
||||
public static PKError LegacyAlreadyHasProxyTag(ProxyTag requested, PKMember member, Context ctx) => new(
|
||||
$"This member already has more than one proxy tag set: {member.ProxyTagsString()}\nConsider using the {$"pk;member {member.Reference(ctx)} proxy add {requested.ProxyString}".AsCode()} command instead.");
|
||||
|
||||
public static PKError EmptyProxyTags(PKMember member) => new(
|
||||
$"The example proxy `text` is equivalent to having no proxy tags at all, since there are no symbols or brackets on either end. If you'd like to clear your proxy tags, use `pk;member {member.Reference()} proxy clear`.");
|
||||
public static PKError EmptyProxyTags(PKMember member, Context ctx) => new(
|
||||
$"The example proxy `text` is equivalent to having no proxy tags at all, since there are no symbols or brackets on either end. If you'd like to clear your proxy tags, use `pk;member {member.Reference(ctx)} proxy clear`.");
|
||||
|
||||
public static PKError GenericCancelled() => new("Operation cancelled.");
|
||||
|
||||
|
@ -279,11 +279,11 @@ public class EmbedService
|
||||
if (memberCount == 0 && pctx == LookupContext.ByOwner)
|
||||
// Only suggest the add command if this is actually the owner lol
|
||||
eb.Field(new Embed.Field("Members (0)",
|
||||
$"Add one with `pk;group {target.Reference()} add <member>`!"));
|
||||
$"Add one with `pk;group {target.Reference(ctx)} add <member>`!"));
|
||||
else
|
||||
{
|
||||
var name = pctx == LookupContext.ByOwner
|
||||
? target.Reference()
|
||||
? target.Reference(ctx)
|
||||
: target.Hid;
|
||||
eb.Field(new Embed.Field($"Members ({memberCount})", $"(see `pk;group {name} list`)"));
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ public static class ModelUtils
|
||||
public static string DisplayName(this PKMember member) =>
|
||||
member.DisplayName ?? member.Name;
|
||||
|
||||
public static string Reference(this PKMember member) => EntityReference(member.Hid, member.Name);
|
||||
public static string Reference(this PKGroup group) => EntityReference(group.Hid, group.Name);
|
||||
public static string Reference(this PKMember member, Context ctx) => EntityReference(member.Hid, member.NameFor(ctx));
|
||||
public static string Reference(this PKGroup group, Context ctx) => EntityReference(group.Hid, group.NameFor(ctx));
|
||||
|
||||
private static string EntityReference(string hid, string name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user