[Bug Fix] Update bot naming check and add more explanation (#3491)

* Refactor my original PR

Block all puncation,numbers, and _

* Add error message
This commit is contained in:
Jonathan Sider
2023-07-12 19:59:17 -07:00
committed by GitHub
parent 4854201b2a
commit 50ce99ce3e
2 changed files with 7 additions and 9 deletions
+5 -2
View File
@@ -1273,8 +1273,11 @@ bool Bot::IsValidName(std::string& name)
if (!isupper(name[0]))
return false;
for (int i = 1; i < name.length(); ++i) {
if ((!RuleB(Bots, AllowCamelCaseNames) && !islower(name[i])) && name[i] != '_') {
for (char c : name.substr(1)) {
if (!RuleB(Bots, AllowCamelCaseNames) && !islower(c)) {
return false;
}
if (isdigit(c) || ispunct(c)) {
return false;
}
}