mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: update all
This commit is contained in:
1 parent
bdea9fdab3
commit
e2f50871ec
86 files changed
+1939
-1537
No files matched your search
@@ -6,21 +6,21 @@ import { translator } from "../localization/translator";
|
||||
|
||||
export async function filtersToDescription(
|
||||
{ nation, tier, type, class: tankClass, tank }: StatFilters,
|
||||
locale: Locale
|
||||
locale: Locale,
|
||||
) {
|
||||
const { strings, bkLocale } = translator(locale);
|
||||
const awaitedTankDefinitions = await fetchTankDefinitions();
|
||||
const info: string[] = [];
|
||||
|
||||
// TODO: somehow localize tank names?
|
||||
if (tank) return awaitedTankDefinitions.tanks[tank].name.locales[bkLocale];
|
||||
if (tank) return awaitedTankDefinitions.tanks[tank].name!.locales[bkLocale];
|
||||
if (nation)
|
||||
info.push((strings.common.nations as Record<string, string>)[nation]);
|
||||
if (tier) {
|
||||
info.push(
|
||||
literals(strings.bot.common.filters.tier, {
|
||||
tier: TIER_ROMAN_NUMERALS[tier],
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (tankClass) info.push(strings.common.tank_class_short[tankClass]);
|
||||
|
||||
@@ -34,12 +34,12 @@ export async function filterStats(
|
||||
(filters.tier === undefined || entry.tier === filters.tier) &&
|
||||
(filters.class === undefined || entry.class === filters.class) &&
|
||||
(filters.type === undefined ||
|
||||
(filters.type === TankType.COLLECTOR &&
|
||||
entry.type === TankType.COLLECTOR) ||
|
||||
(filters.type === TankType.PREMIUM &&
|
||||
entry.type === TankType.PREMIUM) ||
|
||||
(filters.type === TankType.RESEARCHABLE &&
|
||||
entry.type === TankType.RESEARCHABLE)) &&
|
||||
(filters.type === TankType.TANK_TYPE_COLLECTOR &&
|
||||
entry.type === TankType.TANK_TYPE_COLLECTOR) ||
|
||||
(filters.type === TankType.TANK_TYPE_PREMIUM &&
|
||||
entry.type === TankType.TANK_TYPE_PREMIUM) ||
|
||||
(filters.type === TankType.TANK_TYPE_RESEARCHABLE &&
|
||||
entry.type === TankType.TANK_TYPE_RESEARCHABLE)) &&
|
||||
(filters.tank === undefined || entry.id === filters.tank)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Locale, SlashCommandStringOption } from 'discord.js';
|
||||
import { translator } from '../localization/translator';
|
||||
import { localizationObject } from './localizationObject';
|
||||
import { Locale, SlashCommandStringOption } from "discord.js";
|
||||
import { translator } from "../localization/translator";
|
||||
import { localizationObject } from "./localizationObject";
|
||||
|
||||
export function addTankChoices(option: SlashCommandStringOption) {
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
|
||||
return option
|
||||
.setName(strings.bot.common.options.tank.name)
|
||||
.setName(strings.bot.common.options.tank.name!)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.tank.name,
|
||||
|
||||
@@ -13,13 +13,13 @@ import {
|
||||
} from "./autocompleteClan/constants";
|
||||
|
||||
export const tankNamesTechTreeOnly = fetchTankNames().then((names) =>
|
||||
names.filter((tank) => tank.treeType === TankType.RESEARCHABLE)
|
||||
names.filter((tank) => tank.treeType === TankType.TANK_TYPE_RESEARCHABLE),
|
||||
);
|
||||
|
||||
export async function autocompleteTanks(
|
||||
interaction: AutocompleteInteraction<CacheType>,
|
||||
techTreeOnly = false,
|
||||
fields = ["tank"]
|
||||
fields = ["tank"],
|
||||
) {
|
||||
const { unwrap } = translator(interaction.locale);
|
||||
const focusedOption = interaction.options.getFocused(true);
|
||||
@@ -31,7 +31,7 @@ export async function autocompleteTanks(
|
||||
go(
|
||||
focusedOption.value,
|
||||
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
||||
{ keys: SEARCH_KEYS, limit: 10 }
|
||||
{ keys: SEARCH_KEYS, limit: 10 },
|
||||
).map(async (item) => {
|
||||
let name = unwrap(item.obj.searchableName);
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function autocompleteTanks(
|
||||
0,
|
||||
unwrap(item.obj.searchableName).length -
|
||||
overSize -
|
||||
OVERFLOW_SUFFIX.length
|
||||
OVERFLOW_SUFFIX.length,
|
||||
)}${OVERFLOW_SUFFIX}`;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ export async function autocompleteTanks(
|
||||
name,
|
||||
value: `${item.obj.id}`,
|
||||
} satisfies ApplicationCommandOptionChoiceData<string>;
|
||||
})
|
||||
}),
|
||||
)
|
||||
: []
|
||||
: [],
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user