feat: case-insensitive "text" keyword matching for proxy tags

This commit is contained in:
spiral 2021-05-01 19:17:35 +01:00
parent 2e3d771059
commit 1e5ba5f985
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31

View File

@ -26,6 +26,7 @@ namespace PluralKit.Bot
{ {
// // Make sure there's one and only one instance of "text" in the example proxy given // // Make sure there's one and only one instance of "text" in the example proxy given
var prefixAndSuffix = exampleProxy.Split("text"); var prefixAndSuffix = exampleProxy.Split("text");
if (prefixAndSuffix.Length == 1) prefixAndSuffix = prefixAndSuffix[0].Split("TEXT");
if (prefixAndSuffix.Length < 2) throw Errors.ProxyMustHaveText; if (prefixAndSuffix.Length < 2) throw Errors.ProxyMustHaveText;
if (prefixAndSuffix.Length > 2) throw Errors.ProxyMultipleText; if (prefixAndSuffix.Length > 2) throw Errors.ProxyMultipleText;
return new ProxyTag(prefixAndSuffix[0], prefixAndSuffix[1]); return new ProxyTag(prefixAndSuffix[0], prefixAndSuffix[1]);