From e93609df9133a68ce8b0549887d233f96bc1f7a7 Mon Sep 17 00:00:00 2001 From: Iris System Date: Sat, 11 May 2024 11:48:16 +1200 Subject: [PATCH] fix(bot): use ParseHid for input check in CreateNotFoundError --- .../CommandSystem/Context/ContextEntityArgumentsExt.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PluralKit.Bot/CommandSystem/Context/ContextEntityArgumentsExt.cs b/PluralKit.Bot/CommandSystem/Context/ContextEntityArgumentsExt.cs index 1f90d163..8bf273f1 100644 --- a/PluralKit.Bot/CommandSystem/Context/ContextEntityArgumentsExt.cs +++ b/PluralKit.Bot/CommandSystem/Context/ContextEntityArgumentsExt.cs @@ -169,15 +169,16 @@ public static class ContextEntityArgumentsExt public static string CreateNotFoundError(this Context ctx, string entity, string input) { var isIDOnlyQuery = ctx.System == null || ctx.MatchFlag("id", "by-id"); + var inputIsHid = HidUtils.ParseHid(input) != null; if (isIDOnlyQuery) { - if (input.Length >= 5 && input.Length <= 6) + if (inputIsHid) return $"{entity} with ID \"{input}\" not found."; return $"{entity} not found. Note that a {entity.ToLower()} ID is 5 or 6 characters long."; } - if (input.Length >= 5 && input.Length <= 6) + if (inputIsHid) return $"{entity} with ID or name \"{input}\" not found."; return $"{entity} with name \"{input}\" not found. Note that a {entity.ToLower()} ID is 5 or 6 characters long."; }