feat: added ratings leaderboard generation and publication

This commit is contained in:
TresAbhi committed 2023-07-14 01:32:20 +00:00
1 parent 098e6c09b9
commit 6d9e6973d5
35 files changed
+412 -84

No files matched your search

+3 -3
View File
@@ -1,10 +1,10 @@
import { BLITZ_SERVERS, BlitzServer } from '../../constants/servers';
import { REGION_DOMAIN_NAMES, RegionDomain } from '../../constants/regions';
import { TanksStats } from '../../types/tanksStats';
import { WARGAMING_APPLICATION_ID } from '../node/arguments';
import throwError from '../node/throwError';
import getWargamingResponse from './getWargamingResponse';
export default async function getTankStats(server: BlitzServer, id: number) {
export default async function getTankStats(server: RegionDomain, id: number) {
const tankStats = await getWargamingResponse<TanksStats>(
`https://api.wotblitz.${server}/wotb/tanks/stats/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
);
@@ -12,7 +12,7 @@ export default async function getTankStats(server: BlitzServer, id: number) {
if (tankStats[id] === null) {
throw throwError(
'No tank stats available',
`Wargaming says there is no tank stats for this account. This account may not have any battles/tanks or exist in the ${BLITZ_SERVERS[server]} server.`,
`Wargaming says there is no tank stats for this account. This account may not have any battles/tanks or exist in the ${REGION_DOMAIN_NAMES[server]} server.`,
);
}