feat: bug fixes and error safety

This commit is contained in:
TresAbhi committed 2023-05-28 16:56:15 +00:00
1 parent 0b6b2ecedc
commit 780d9d5f8e
25 files changed
+136 -182

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ export const serverAndIdPattern = /(com|eu|asia)\/[0-9]+/;
export default async function getBlitzAccount(
interaction: ChatInputCommandInteraction<CacheType>,
username: string,
): Promise<{ server: BlitzServer; id: number } | null> {
) {
if (serverAndIdPattern.test(username)) {
const [server, accountId] = username.split('/');
return { server: server as BlitzServer, id: Number(accountId) };
@@ -27,7 +27,7 @@ export default async function getBlitzAccount(
],
});
return null;
throw new Error(`Could not find user "${username}"`);
}
}
}