diff --git a/PluralKit.Bot/Commands/Admin.cs b/PluralKit.Bot/Commands/Admin.cs index 7503af06..e7ed749b 100644 --- a/PluralKit.Bot/Commands/Admin.cs +++ b/PluralKit.Bot/Commands/Admin.cs @@ -240,7 +240,7 @@ public class Admin var existingAccount = await ctx.Repository.GetSystemByAccount(account.Id); if (existingAccount != null) - throw Errors.AccountInOtherSystem(existingAccount); + throw Errors.AccountInOtherSystem(existingAccount, ctx.Config); var system = await ctx.Repository.GetSystem(systemId.Value!); diff --git a/PluralKit.Bot/Commands/Member.cs b/PluralKit.Bot/Commands/Member.cs index 9af1281b..b25b969f 100644 --- a/PluralKit.Bot/Commands/Member.cs +++ b/PluralKit.Bot/Commands/Member.cs @@ -40,7 +40,7 @@ public class Member var existingMember = await ctx.Repository.GetMemberByName(ctx.System.Id, memberName); if (existingMember != null) { - var msg = $"{Emojis.Warn} You already have a member in your system with the name \"{existingMember.NameFor(ctx)}\" (with ID `{existingMember.Hid}`). Do you want to create another member with the same name?"; + var msg = $"{Emojis.Warn} You already have a member in your system with the name \"{existingMember.NameFor(ctx)}\" (with ID `{existingMember.DisplayHid(ctx.Config)}`). Do you want to create another member with the same name?"; if (!await ctx.PromptYesNo(msg, "Create")) throw new PKError("Member creation cancelled."); } diff --git a/PluralKit.Bot/Commands/MemberEdit.cs b/PluralKit.Bot/Commands/MemberEdit.cs index 36b55e74..84afc443 100644 --- a/PluralKit.Bot/Commands/MemberEdit.cs +++ b/PluralKit.Bot/Commands/MemberEdit.cs @@ -339,7 +339,7 @@ public class MemberEdit var eb = new EmbedBuilder() .Title("Member names") .Footer(new Embed.EmbedFooter( - $"Member ID: {target.Hid} | Active name in bold. Server name overrides display name, which overrides base name." + $"Member ID: {target.DisplayHid(ctx.Config)} | Active name in bold. Server name overrides display name, which overrides base name." + (target.DisplayName != null && ctx.System?.Id == target.System ? $" Using {target.DisplayName.Length}/{Limits.MaxMemberNameLength} characters for the display name." : "") + (memberGuildConfig?.DisplayName != null ? $" Using {memberGuildConfig?.DisplayName.Length}/{Limits.MaxMemberNameLength} characters for the server name." : ""))); diff --git a/PluralKit.Bot/Commands/SystemFront.cs b/PluralKit.Bot/Commands/SystemFront.cs index 08fdf18c..adead8f5 100644 --- a/PluralKit.Bot/Commands/SystemFront.cs +++ b/PluralKit.Bot/Commands/SystemFront.cs @@ -76,7 +76,7 @@ public class SystemFront var members = await ctx.Database.Execute(c => ctx.Repository.GetSwitchMembers(c, sw.Id)).ToListAsync(); var membersStr = members.Any() - ? string.Join(", ", members.Select(m => $"**{m.NameFor(ctx)}**{(showMemberId ? $" (`{m.Hid}`)" : "")}")) + ? string.Join(", ", members.Select(m => $"**{m.NameFor(ctx)}**{(showMemberId ? $" (`{m.DisplayHid(ctx.Config)}`)" : "")}")) : "**no fronter**"; var switchSince = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp; @@ -138,13 +138,13 @@ public class SystemFront if (ctx.Guild != null) guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id); if (group != null) - title.Append($"{group.NameFor(ctx)} (`{group.Hid}`)"); + title.Append($"{group.NameFor(ctx)} (`{group.DisplayHid(ctx.Config)}`)"); else if (ctx.Guild != null && guildSettings.DisplayName != null) - title.Append($"{guildSettings.DisplayName} (`{system.Hid}`)"); + title.Append($"{guildSettings.DisplayName} (`{system.DisplayHid(ctx.Config)}`)"); else if (system.NameFor(ctx) != null) - title.Append($"{system.NameFor(ctx)} (`{system.Hid}`)"); + title.Append($"{system.NameFor(ctx)} (`{system.DisplayHid(ctx.Config)}`)"); else - title.Append($"`{system.Hid}`"); + title.Append($"`{system.DisplayHid(ctx.Config)}`"); var frontpercent = await ctx.Database.Execute(c => ctx.Repository.GetFrontBreakdown(c, system.Id, group?.Id, rangeStart.Value.ToInstant(), now)); await ctx.Reply(embed: await _embeds.CreateFrontPercentEmbed(frontpercent, system, group, ctx.Zone, diff --git a/PluralKit.Bot/Commands/SystemLink.cs b/PluralKit.Bot/Commands/SystemLink.cs index 593f1ad1..330b701a 100644 --- a/PluralKit.Bot/Commands/SystemLink.cs +++ b/PluralKit.Bot/Commands/SystemLink.cs @@ -18,7 +18,7 @@ public class SystemLink var existingAccount = await ctx.Repository.GetSystemByAccount(account.Id); if (existingAccount != null) - throw Errors.AccountInOtherSystem(existingAccount); + throw Errors.AccountInOtherSystem(existingAccount, ctx.Config); var msg = $"{account.Mention()}, please confirm the link."; if (!await ctx.PromptYesNo(msg, "Confirm", account, false)) throw Errors.MemberLinkCancelled; diff --git a/PluralKit.Bot/Errors.cs b/PluralKit.Bot/Errors.cs index 04f3d33e..ca40f248 100644 --- a/PluralKit.Bot/Errors.cs +++ b/PluralKit.Bot/Errors.cs @@ -120,8 +120,8 @@ public static class Errors public static PKError UrlTooLong(string url) => new($"The given URL is too long ({url.Length}/{Limits.MaxUriLength} characters)."); - public static PKError AccountInOtherSystem(PKSystem system) => - new($"The mentioned account is already linked to another system (see `pk;system {system.Hid}`)."); + public static PKError AccountInOtherSystem(PKSystem system, SystemConfig config) => + new($"The mentioned account is already linked to another system (see `pk;system {system.DisplayHid(config)}`)."); public static PKError SameSwitch(ICollection members, LookupContext ctx) { diff --git a/PluralKit.Bot/Services/EmbedService.cs b/PluralKit.Bot/Services/EmbedService.cs index 2f7fc5a6..be2e6b41 100644 --- a/PluralKit.Bot/Services/EmbedService.cs +++ b/PluralKit.Bot/Services/EmbedService.cs @@ -255,7 +255,7 @@ public class EmbedService // More than 5 groups show in "compact" format without ID var content = groups.Count > 5 ? string.Join(", ", groups.Select(g => g.DisplayName ?? g.Name)) - : string.Join("\n", groups.Select(g => $"[`{g.Hid}`] **{g.DisplayName ?? g.Name}**")); + : string.Join("\n", groups.Select(g => $"[`{g.DisplayHid(ccfg)}`] **{g.DisplayName ?? g.Name}**")); eb.Field(new Embed.Field($"Groups ({groups.Count})", content.Truncate(1000))); } @@ -324,7 +324,7 @@ public class EmbedService { var name = pctx == LookupContext.ByOwner ? target.Reference(ctx) - : target.Hid; + : target.DisplayHid(ctx.Config); eb.Field(new Embed.Field($"Members ({memberCount})", $"(see `pk;group {name} list`)")); } }