feat: cleaned node

This commit is contained in:
TresAbhi committed 2023-06-27 17:22:27 +00:00
1 parent 01ed20941d
commit ab5061ba99
28 files changed
+35 -37

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
export interface PSAData {
title: string;
description: string;
}
export interface PSA {
data: PSAData | null;
}
export const psa: PSA = { data: null };
console.log('Caching PSA...');
fetch(
'https://gist.githubusercontent.com/tresabhi/ed4b136f08856e615212e573aabe1968/raw',
)
.then((response) => response.json())
.then((data) => {
psa.data = data as PSAData;
console.log('PSA cached');
});
+3 -3
View File
@@ -3,7 +3,7 @@ import { BlitzServer } from '../../constants/servers.js';
import listPlayers, {
usernamePatternWithoutPosition,
} from '../blitz/listPlayers.js';
import errorWithCause from '../node/errorWithCause.js';
import throwError from '../node/throwError.js';
export const serverAndIdPattern = /(com|eu|asia)\/[0-9]+/;
@@ -22,7 +22,7 @@ export default async function resolvePlayerFromCommand(
const username = commandUsername ?? displayName;
if (username === undefined) {
throw errorWithCause(
throw throwError(
'Username could not be inferred',
"You didn't provide me a username in the command nor was I able to infer your Blitz username from your Discord nickname. Try providing a username manually in the command or using the `/verify` command to set your Discord nickname to your Blitz username.",
);
@@ -43,7 +43,7 @@ export default async function resolvePlayerFromCommand(
id: accounts[0].account_id,
} satisfies ResolvedPlayer;
} else {
throw errorWithCause(
throw throwError(
'Could not find user',
`I couldn't find user \`${username}\`. Try providing a valid username manually or using the \`/verify\` command to set your Discord nickname to your Blitz username.`,
);