mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
feat: cleaned node
This commit is contained in:
1 parent
01ed20941d
commit
ab5061ba99
28 files changed
+35
-37
No files matched your search
@@ -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,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.`,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user