mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: core chunk 3
This commit is contained in:
1 parent
970ab9004e
commit
07e3660388
25 files changed
+57
-58
No files matched your search
@@ -4,11 +4,11 @@ import {
|
||||
} from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import * as Graph from '../components/Graph';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import resolveTankId from '../core/blitz/resolveTankId';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import getPlayerHistories from '../core/blitzstars/getPlayerHistories';
|
||||
@@ -41,7 +41,7 @@ async function render(
|
||||
) {
|
||||
const accountInfo = await getAccountInfo(region, id);
|
||||
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||
const logo = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||
const logo = clan ? emblemIdToURL(clan.emblem_set_id) : undefined;
|
||||
const histories = await (type === 'player'
|
||||
? getPlayerHistories(region, id, {
|
||||
start,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
||||
import GenericAllStats from '../components/GenericAllStats';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TierWeights from '../components/TierWeights';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||
import { getTierWeights } from '../core/blitzkrieg/getTierWeights';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
@@ -38,7 +38,7 @@ async function render(
|
||||
) {
|
||||
const { nickname } = await getAccountInfo(region, id);
|
||||
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||
const clanImage = clan ? emblemIdToURL(clan.emblem_set_id) : undefined;
|
||||
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
||||
const { stats, supplementary, filteredOrder } = await filterStats(
|
||||
diffedTankStats,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import getTankStats from '../_core/blitz/getTankStats';
|
||||
import getTreeType from '../_core/blitz/getTreeType';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import * as Tanks from '../components/Tanks';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import getTankStats from '../core/blitz/getTankStats';
|
||||
import getTreeType from '../core/blitz/getTreeType';
|
||||
import resolveTankName from '../core/blitz/resolveTankName';
|
||||
import {
|
||||
TIER_ROMAN_NUMERALS,
|
||||
@@ -67,7 +67,7 @@ export const ownedTanksCommand: CommandRegistry = {
|
||||
name={accountInfo.nickname}
|
||||
image={
|
||||
clanAccountInfo?.clan
|
||||
? getClanLogo(clanAccountInfo.clan.emblem_set_id)
|
||||
? emblemIdToURL(clanAccountInfo.clan.emblem_set_id)
|
||||
: undefined
|
||||
}
|
||||
description={`Tier ${TIER_ROMAN_NUMERALS[tier as Tier]} tanks`}
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
import { BlitzkriegRatingsLeaderboard } from '../../scripts/buildRatingsLeaderboard';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import getRatingsInfo from '../_core/blitz/getRatingsInfo';
|
||||
import getArchivedRatingsInfo from '../_core/blitzkrieg/getArchivedRatingsInfo';
|
||||
import * as Leaderboard from '../components/Leaderboard';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { REGION_NAMES_SHORT, Region } from '../constants/regions';
|
||||
import getRatingsInfo from '../core/blitz/getRatingsInfo';
|
||||
import regionToRegionSubdomain from '../core/blitz/regionToRegionSubdomain';
|
||||
import getMidnightLeaderboard, {
|
||||
DATABASE_REPO,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import fetchBlitz from '../_core/blitz/fetchWargaming';
|
||||
import { REGION_NAMES, Region } from '../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
||||
import addClanChoices from '../core/discord/addClanChoices';
|
||||
import addRegionChoices from '../core/discord/addRegionChoices';
|
||||
import embedInfo from '../core/discord/embedInfo';
|
||||
@@ -30,7 +30,7 @@ export const searchClansCommand: CommandRegistry = {
|
||||
const server = interaction.options.getString('region') as Region;
|
||||
const clan = interaction.options.getString('clan')!;
|
||||
const limit = interaction.options.getInteger('limit') ?? 25;
|
||||
const clanList = await getWargamingResponse<ClanList>(
|
||||
const clanList = await fetchBlitz<ClanList>(
|
||||
`https://api.wotblitz.${server}/wotb/clans/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${clan}&limit=${limit}`,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import fetchBlitz from '../_core/blitz/fetchWargaming';
|
||||
import { REGION_NAMES, Region } from '../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
||||
import { AccountList, usernamePattern } from '../core/blitz/listPlayers';
|
||||
import addRegionChoices from '../core/discord/addRegionChoices';
|
||||
import addUsernameChoices from '../core/discord/addUsernameChoices';
|
||||
@@ -34,7 +34,7 @@ export const searchPlayersCommand: CommandRegistry = {
|
||||
const limit = interaction.options.getInteger('limit') ?? 25;
|
||||
const trimmedSearch = name.trim();
|
||||
const players = usernamePattern.test(trimmedSearch)
|
||||
? await getWargamingResponse<AccountList>(
|
||||
? await fetchBlitz<AccountList>(
|
||||
`https://api.wotblitz.${server}/wotb/account/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${encodeURIComponent(
|
||||
trimmedSearch,
|
||||
)}&limit=${limit}`,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
||||
import AllStatsOverview from '../components/AllStatsOverview';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import getDiffedTankStats from '../core/blitzstars/getDiffedTankStats';
|
||||
@@ -36,7 +36,7 @@ async function render(
|
||||
) {
|
||||
const { nickname } = await getAccountInfo(region, id);
|
||||
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||
const clanImage = clan ? emblemIdToURL(clan.emblem_set_id) : undefined;
|
||||
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
||||
const { stats, supplementary } = await filterStats(diffedTankStats, filters);
|
||||
const filterDescriptions = await filtersToDescription(filters);
|
||||
|
||||
Reference in new issue
Block a user