feat: search min and max lengths

This commit is contained in:
tresabhi committed 2024-12-14 13:27:45 -06:00
1 parent 3b429a6c05
commit 73cb3873d9
6 files changed
+64 -7

No files matched your search

+3 -1
View File
@@ -154,7 +154,9 @@
"no_tank_stats": "# No tank stats available\nThis player doesn't have any stats available. This may not be the player you are looking for.",
"get_help": "Help Discord server",
"uncaught_error": "# BlitzKit ran into an error!\nWe're so sorry about this. Feel free to [join the official Discord server](https://discord.gg/nDt7AjGJQH) to get help.",
"preview": "# This command is in preview\n\nYou can only access this command in [the official Discord server](https://discord.gg/nDt7AjGJQH). The command will be generally available soon."
"preview": "# This command is in preview\n\nYou can only access this command in [the official Discord server](https://discord.gg/nDt7AjGJQH). The command will be generally available soon.",
"query_too_small": "# Your search is too short\nYour search must be at least 3 characters long.",
"query_too_long": "# Your search is too long\nYour search must be at most 100 characters long."
},
"wn8": {
@@ -11,10 +11,11 @@ export type AccountListWithServer = (AccountListItem & {
})[];
export async function searchPlayersAcrossRegions(search: string, limit = 25) {
const trimmedSearch = search.trim();
const trimmed = search.trim();
if (trimmed.length < 3 && trimmed.length > 100) return [];
const normalizedLimit = Math.floor(limit / 3);
if (usernamePattern.test(trimmedSearch)) {
if (usernamePattern.test(trimmed)) {
return (
await Promise.all([
fetchBlitz<AccountList>('com', 'account/list', {