diff --git a/PluralKit/Bot/Commands/MemberCommands.cs b/PluralKit/Bot/Commands/MemberCommands.cs index e7d43fad..3339bd78 100644 --- a/PluralKit/Bot/Commands/MemberCommands.cs +++ b/PluralKit/Bot/Commands/MemberCommands.cs @@ -84,6 +84,19 @@ namespace PluralKit.Bot.Commands await Context.Channel.SendMessageAsync($"{Emojis.Success} Member description {(description == null ? "cleared" : "changed")}."); } + [Command("pronouns")] + [Alias("pronoun")] + [Remarks("member pronouns Limits.MaxPronounsLength) throw Errors.MemberPronounsTooLongError(pronouns.Length); + + ContextEntity.Pronouns = pronouns; + await Members.Save(ContextEntity); + + await Context.Channel.SendMessageAsync($"{Emojis.Success} Member pronouns {(pronouns == null ? "cleared" : "changed")}."); + } + public override async Task ReadContextParameterAsync(string value) { var res = await new PKMemberTypeReader().ReadAsync(Context, value, _services); diff --git a/PluralKit/Bot/Errors.cs b/PluralKit/Bot/Errors.cs index 12938bf1..7508fce9 100644 --- a/PluralKit/Bot/Errors.cs +++ b/PluralKit/Bot/Errors.cs @@ -1,16 +1,17 @@ namespace PluralKit.Bot { public static class Errors { // TODO: is returning constructed errors and throwing them at call site a good idea, or should these be methods that insta-throw instead? - + public static PKError NotOwnSystemError => new PKError($"You can only run this command on your own system."); public static PKError NotOwnMemberError => new PKError($"You can only run this command on your own member."); public static PKError NoSystemError => new PKError("You do not have a system registered with PluralKit. To create one, type `pk;system new`."); public static PKError ExistinSystemError => new PKError("You already have a system registered with PluralKit. To view it, type `pk;system`. If you'd like to delete your system and start anew, type `pk;system delete`, or if you'd like to unlink this account from it, type `pk;unlink`."); public static PKError MissingMemberError => new PKSyntaxError("You need to specify a member to run this command on."); - public static PKError SystemNameTooLongError(int nameLength) => new PKError($"Your chosen system name is too long ({nameLength}/{Limits.MaxSystemNameLength} characters)."); - public static PKError SystemTagTooLongError(int nameLength) => new PKError($"Your chosen system tag is too long ({nameLength}/{Limits.MaxSystemTagLength} characters)."); - public static PKError DescriptionTooLongError(int nameLength) => new PKError($"Your chosen description is too long ({nameLength}/{Limits.MaxDescriptionLength} characters)."); - public static PKError MemberNameTooLongError(int nameLength) => new PKError($"Your chosen member name is too long ({nameLength}/{Limits.MaxMemberNameLength} characters)."); + public static PKError SystemNameTooLongError(int length) => new PKError($"System name too long ({length}/{Limits.MaxSystemNameLength} characters)."); + public static PKError SystemTagTooLongError(int length) => new PKError($"System tag too long ({length}/{Limits.MaxSystemTagLength} characters)."); + public static PKError DescriptionTooLongError(int length) => new PKError($"Description too long ({length}/{Limits.MaxDescriptionLength} characters)."); + public static PKError MemberNameTooLongError(int length) => new PKError($"Member name too long ({length}/{Limits.MaxMemberNameLength} characters)."); + public static PKError MemberPronounsTooLongError(int length) => new PKError($"Member pronouns too long ({length}/{Limits.MaxMemberNameLength} characters)."); } } \ No newline at end of file diff --git a/PluralKit/Bot/Limits.cs b/PluralKit/Bot/Limits.cs index e0fe0b29..9971bcfc 100644 --- a/PluralKit/Bot/Limits.cs +++ b/PluralKit/Bot/Limits.cs @@ -4,5 +4,6 @@ namespace PluralKit.Bot { public static readonly int MaxSystemTagLength = 31; public static readonly int MaxDescriptionLength = 1000; public static readonly int MaxMemberNameLength = 50; + public static readonly int MaxPronounsLength = 100; } } \ No newline at end of file