From f37a6f42903028029f2066b05ab430aeb77f3113 Mon Sep 17 00:00:00 2001 From: Petal Ladenson Date: Fri, 4 Oct 2024 04:55:46 -0600 Subject: [PATCH] fix(bot): respect character limit for group display names --- PluralKit.Bot/Commands/Groups.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index 36726056..0fe078e3 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -191,6 +191,8 @@ public class Groups else { var newDisplayName = ctx.RemainderOrNull(false).NormalizeLineEndSpacing(); + if (newDisplayName.Length > Limits.MaxGroupNameLength) + throw new PKError($"Group name too long ({newDisplayName.Length}/{Limits.MaxGroupNameLength} characters)."); var patch = new GroupPatch { DisplayName = Partial.Present(newDisplayName) }; await ctx.Repository.UpdateGroup(target.Id, patch);