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

@@ -118,7 +118,7 @@ public class Groups
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { Name = newName });
await ctx.Reply($"{Emojis.Success} Group name changed from **{target.Name}** to **{newName}**.");
await ctx.Reply($"{Emojis.Success} Group name changed from **{target.Name}** to **{newName}** (using {newName.Length}/{Limits.MaxGroupNameLength} characters).");
}
public async Task GroupDisplayName(Context ctx, PKGroup target)
@@ -159,6 +159,8 @@ public class Groups
+ $"To clear it, type `pk;group {reference} displayname -clear`."
+ $"To print the raw display name, type `pk;group {reference} displayname -raw`.");
eb.Footer(new Embed.EmbedFooter($"Using {target.DisplayName.Length}/{Limits.MaxGroupNameLength} characters."));
await ctx.Reply(embed: eb.Build());
}
@@ -183,7 +185,7 @@ public class Groups
var patch = new GroupPatch { DisplayName = Partial<string>.Present(newDisplayName) };
await ctx.Repository.UpdateGroup(target.Id, patch);
await ctx.Reply($"{Emojis.Success} Group display name changed.");
await ctx.Reply($"{Emojis.Success} Group display name changed (using {newDisplayName.Length}/{Limits.MaxGroupNameLength} characters).");
}
}
@@ -217,7 +219,8 @@ public class Groups
$"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(ctx)} description -clear`."
: "")))
: "")
+ $" Using {target.Description.Length}/{Limits.MaxDescriptionLength} characters."))
.Build());
return;
}
@@ -239,7 +242,7 @@ public class Groups
var patch = new GroupPatch { Description = Partial<string>.Present(description) };
await ctx.Repository.UpdateGroup(target.Id, patch);
await ctx.Reply($"{Emojis.Success} Group description changed.");
await ctx.Reply($"{Emojis.Success} Group description changed (using {description.Length}/{Limits.MaxDescriptionLength} characters).");
}
}