fix regex for vanity ids

This commit is contained in:
Stanley Dimant
2022-10-04 17:03:40 +02:00
parent e2e97065f4
commit 08b04e14d5

View File

@@ -169,7 +169,7 @@ public class DiscordBot : IHostedService
} }
} }
Regex rgx = new(@"[_\-a-zA-Z0-9]{5,20}", RegexOptions.ECMAScript); Regex rgx = new(@"^[_\-a-zA-Z0-9]{5,20}$", RegexOptions.ECMAScript);
if (!rgx.Match(newGid).Success || newGid.Length < 5 || newGid.Length > 20) if (!rgx.Match(newGid).Success || newGid.Length < 5 || newGid.Length > 20)
{ {
eb.WithTitle("Failed to set Vanity Syncshell Id"); eb.WithTitle("Failed to set Vanity Syncshell Id");
@@ -236,7 +236,7 @@ public class DiscordBot : IHostedService
} }
} }
Regex rgx = new(@"[_\-a-zA-Z0-9]{5,15}", RegexOptions.ECMAScript); Regex rgx = new(@"^[_\-a-zA-Z0-9]{5,15}$", RegexOptions.ECMAScript);
if (!rgx.Match(newUid).Success || newUid.Length < 5 || newUid.Length > 15) if (!rgx.Match(newUid).Success || newUid.Length < 5 || newUid.Length > 15)
{ {
eb.WithTitle("Failed to set Vanity UID"); eb.WithTitle("Failed to set Vanity UID");