feat: show character amount for string fields

This commit is contained in:
Jake Fulmine
2022-08-27 11:25:44 +02:00
parent e23b1048c9
commit c77b2bb4fc
4 changed files with 32 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ public class MemberEdit
var patch = new MemberPatch { Name = Partial<string>.Present(newName) };
await ctx.Repository.UpdateMember(target.Id, patch);
await ctx.Reply($"{Emojis.Success} Member renamed.");
await ctx.Reply($"{Emojis.Success} Member renamed (using {newName.Length}/{Limits.MaxMemberNameLength} characters).");
if (newName.Contains(" "))
await ctx.Reply(
$"{Emojis.Note} Note that this member's name now contains spaces. You will need to surround it with \"double quotes\" when using commands referring to it.");
@@ -89,7 +89,8 @@ public class MemberEdit
$"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(ctx)} description -clear`."
: "")))
: "")
+ $" Using {target.Description.Length}/{Limits.MaxDescriptionLength} characters."))
.Build());
return;
}
@@ -111,7 +112,7 @@ public class MemberEdit
var patch = new MemberPatch { Description = Partial<string>.Present(description) };
await ctx.Repository.UpdateMember(target.Id, patch);
await ctx.Reply($"{Emojis.Success} Member description changed.");
await ctx.Reply($"{Emojis.Success} Member description changed (using {description.Length}/{Limits.MaxDescriptionLength} characters).");
}
}
@@ -141,7 +142,8 @@ public class MemberEdit
$"**{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(ctx)} pronouns -clear`."
: ""));
: "")
+ $" Using {target.Pronouns.Length}/{Limits.MaxPronounsLength} characters.");
return;
}
@@ -162,7 +164,7 @@ public class MemberEdit
var patch = new MemberPatch { Pronouns = Partial<string>.Present(pronouns) };
await ctx.Repository.UpdateMember(target.Id, patch);
await ctx.Reply($"{Emojis.Success} Member pronouns changed.");
await ctx.Reply($"{Emojis.Success} Member pronouns changed (using {pronouns.Length}/{Limits.MaxPronounsLength} characters).");
}
}
@@ -333,7 +335,9 @@ 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.Hid} | Active name in bold. Server name overrides display name, which overrides base name."
+ (target.DisplayName != null ? $" 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." : "")));
var showDisplayName = target.NamePrivacy.CanAccess(lcx);
@@ -423,7 +427,7 @@ public class MemberEdit
await ctx.Repository.UpdateMember(target.Id, patch);
await PrintSuccess(
$"{Emojis.Success} Member display name changed. This member will now be proxied using the name \"{newDisplayName}\".");
$"{Emojis.Success} Member display name changed (using {newDisplayName.Length}/{Limits.MaxMemberNameLength} characters). This member will now be proxied using the name \"{newDisplayName}\".");
}
}
@@ -480,7 +484,7 @@ public class MemberEdit
new MemberGuildPatch { DisplayName = newServerName });
await ctx.Reply(
$"{Emojis.Success} Member server name changed. This member will now be proxied using the name \"{newServerName}\" in this server ({ctx.Guild.Name}).");
$"{Emojis.Success} Member server name changed (using {newServerName.Length}/{Limits.MaxMemberNameLength} characters). This member will now be proxied using the name \"{newServerName}\" in this server ({ctx.Guild.Name}).");
}
}