From b912731cf94f8fc877c37de610f81941079f94c1 Mon Sep 17 00:00:00 2001 From: SirKhaoz Date: Fri, 4 Nov 2022 21:56:39 +1300 Subject: [PATCH] Added "-" as a valid character in "getStats" --- src/hiscores.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hiscores.ts b/src/hiscores.ts index efdd572..8bcc88d 100644 --- a/src/hiscores.ts +++ b/src/hiscores.ts @@ -159,7 +159,7 @@ export function parseStats(csv: string): Stats { export async function getStats(rsn: string): Promise { if (typeof rsn !== 'string') { throw Error('RSN must be a string'); - } else if (!/^[a-zA-Z0-9 _]+$/.test(rsn)) { + } else if (!/^[a-zA-Z0-9 _-]+$/.test(rsn)) { throw Error('RSN contains invalid character'); } else if (rsn.length > 12 || rsn.length < 1) { throw Error('RSN must be between 1 and 12 characters'); @@ -246,7 +246,7 @@ export async function getStatsByGamemode( ): Promise { if (typeof rsn !== 'string') { throw Error('RSN must be a string'); - } else if (!/^[a-zA-Z0-9 _]+$/.test(rsn)) { + } else if (!/^[a-zA-Z0-9 _-]+$/.test(rsn)) { throw Error('RSN contains invalid character'); } else if (rsn.length > 12 || rsn.length < 1) { throw Error('RSN must be between 1 and 12 characters');