mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: replace $
This commit is contained in:
1 parent
98724df711
commit
f9f7468544
17 files changed
+182
-175
No files matched your search
@@ -10,11 +10,11 @@ import { createLocalizedCommand } from '../core/discord/createLocalizedCommand';
|
||||
import { translator } from '../core/localization/translator';
|
||||
import { CommandRegistry } from '../events/interactionCreate';
|
||||
|
||||
interface Auction {
|
||||
type Auction = null | {
|
||||
count: number;
|
||||
has_next: boolean;
|
||||
results: Result[];
|
||||
}
|
||||
};
|
||||
|
||||
type Result =
|
||||
| {
|
||||
@@ -88,12 +88,12 @@ export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
pageSize
|
||||
}&type[]=vehicle&saleable=${saleable}`,
|
||||
).then((response) => response.json() as Promise<Auction>);
|
||||
const saleableTanks = data.results.filter((result) => result.available);
|
||||
|
||||
if (saleableTanks.length === 0) {
|
||||
if (data === null) {
|
||||
return strings.bot.commands.auction.errors.no_auction;
|
||||
}
|
||||
|
||||
const saleableTanks = data.results.filter((result) => result.available);
|
||||
const nextPricesTimestamp = saleableTanks[0].next_price_timestamp;
|
||||
|
||||
const title = `# ${strings.bot.commands.auction.body.title}`;
|
||||
|
||||
@@ -26,7 +26,7 @@ export const inactiveCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
.setName('threshold')
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.commands.inactive.options.threshold.$,
|
||||
(strings) => strings.bot.commands.inactive.options.threshold.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -60,11 +60,11 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
|
||||
return option
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.commands.rating_leaderboard.options.limit.$)
|
||||
.setName(strings.bot.commands.rating_leaderboard.options.limit.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) =>
|
||||
strings.bot.commands.rating_leaderboard.options.limit.$,
|
||||
strings.bot.commands.rating_leaderboard.options.limit.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -90,11 +90,13 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.commands.rating_leaderboard.options.season.$)
|
||||
.setName(
|
||||
strings.bot.commands.rating_leaderboard.options.season.name,
|
||||
)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) =>
|
||||
strings.bot.commands.rating_leaderboard.options.season.$,
|
||||
strings.bot.commands.rating_leaderboard.options.season.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -159,13 +161,13 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
|
||||
|
||||
return option
|
||||
.setName(
|
||||
strings.bot.commands.rating_leaderboard.options.league.$,
|
||||
strings.bot.commands.rating_leaderboard.options.league.name,
|
||||
)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) =>
|
||||
strings.bot.commands.rating_leaderboard.options.league
|
||||
.$,
|
||||
.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -35,10 +35,11 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
command: createLocalizedCommand('research')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.commands.research.options.target_tank.$)
|
||||
.setName(strings.bot.commands.research.options.target_tank.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.commands.research.options.target_tank.$,
|
||||
(strings) =>
|
||||
strings.bot.commands.research.options.target_tank.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -57,11 +58,11 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.commands.research.options.starting_tank.$)
|
||||
.setName(strings.bot.commands.research.options.starting_tank.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) =>
|
||||
strings.bot.commands.research.options.starting_tank.$,
|
||||
strings.bot.commands.research.options.starting_tank.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -23,10 +23,10 @@ export const searchClansCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
|
||||
return option
|
||||
.setName(strings.bot.commands.search_clans.options.limit.$)
|
||||
.setName(strings.bot.commands.search_clans.options.limit.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.commands.search_clans.options.limit.$,
|
||||
(strings) => strings.bot.commands.search_clans.options.limit.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -28,10 +28,11 @@ export const searchPlayersCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
)
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.commands.search_players.options.limit.$)
|
||||
.setName(strings.bot.commands.search_players.options.limit.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.commands.search_players.options.limit.$,
|
||||
(strings) =>
|
||||
strings.bot.commands.search_players.options.limit.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -30,7 +30,7 @@ export function GenericAllStats({
|
||||
<Root>
|
||||
<Row>
|
||||
<Card
|
||||
title={strings.bot.commands.full_stats.body.cards.games.$}
|
||||
title={strings.bot.commands.full_stats.body.cards.games.title}
|
||||
items={[
|
||||
{
|
||||
label: strings.bot.commands.full_stats.body.cards.games.winrate,
|
||||
@@ -48,7 +48,7 @@ export function GenericAllStats({
|
||||
]}
|
||||
/>
|
||||
<Card
|
||||
title={strings.bot.commands.full_stats.body.cards.efficiency.$}
|
||||
title={strings.bot.commands.full_stats.body.cards.efficiency.title}
|
||||
items={[
|
||||
{
|
||||
label: strings.bot.commands.full_stats.body.cards.efficiency.wn8,
|
||||
@@ -78,7 +78,7 @@ export function GenericAllStats({
|
||||
</Row>
|
||||
<Row>
|
||||
<Card
|
||||
title={strings.bot.commands.full_stats.body.cards.lethality.$}
|
||||
title={strings.bot.commands.full_stats.body.cards.lethality.title}
|
||||
items={[
|
||||
{
|
||||
label:
|
||||
@@ -113,7 +113,7 @@ export function GenericAllStats({
|
||||
]}
|
||||
/>
|
||||
<Card
|
||||
title={strings.bot.commands.full_stats.body.cards.miscellaneous.$}
|
||||
title={strings.bot.commands.full_stats.body.cards.miscellaneous.title}
|
||||
items={[
|
||||
{
|
||||
label:
|
||||
|
||||
@@ -9,7 +9,7 @@ export function addClanChoices(option: SlashCommandStringOption) {
|
||||
.setName('clan')
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.clan.$,
|
||||
(strings) => strings.bot.common.options.clan.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -23,10 +23,10 @@ export function addFilterOptions<
|
||||
option
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.common.options.filters.nation.$)
|
||||
.setName(strings.bot.common.options.filters.nation.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.filters.nation.$,
|
||||
(strings) => strings.bot.common.options.filters.nation.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -60,10 +60,10 @@ export function addFilterOptions<
|
||||
.addStringOption((option) => addTierChoices(option).setRequired(false))
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.common.options.filters.class.$)
|
||||
.setName(strings.bot.common.options.filters.class.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.filters.class.$,
|
||||
(strings) => strings.bot.common.options.filters.class.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -90,10 +90,10 @@ export function addFilterOptions<
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.common.options.filters.type.$)
|
||||
.setName(strings.bot.common.options.filters.type.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.filters.type.$,
|
||||
(strings) => strings.bot.common.options.filters.type.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -19,32 +19,32 @@ export function addPeriodSubCommands(
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
const subcommandNameLocalizations = {
|
||||
today: localizationObject(
|
||||
(strings) => strings.bot.common.subcommands.today.$,
|
||||
(strings) => strings.bot.common.subcommands.today.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
30: localizationObject(
|
||||
(strings) => strings.bot.common.subcommands[30].$,
|
||||
(strings) => strings.bot.common.subcommands[30].name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
60: localizationObject(
|
||||
(strings) => strings.bot.common.subcommands[60].$,
|
||||
(strings) => strings.bot.common.subcommands[60].name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
90: localizationObject(
|
||||
(strings) => strings.bot.common.subcommands[90].$,
|
||||
(strings) => strings.bot.common.subcommands[90].name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
career: localizationObject(
|
||||
(strings) => strings.bot.common.subcommands.career.$,
|
||||
(strings) => strings.bot.common.subcommands.career.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
custom: localizationObject(
|
||||
(strings) => strings.bot.common.subcommands.custom.$,
|
||||
(strings) => strings.bot.common.subcommands.custom.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -74,7 +74,7 @@ export function addPeriodSubCommands(
|
||||
.addSubcommand((option) =>
|
||||
extra(
|
||||
option
|
||||
.setName(strings.bot.common.subcommands.today.$)
|
||||
.setName(strings.bot.common.subcommands.today.name)
|
||||
.setNameLocalizations(subcommandNameLocalizations.today)
|
||||
.setDescription(strings.bot.common.subcommands.today.description)
|
||||
.setDescriptionLocalizations(
|
||||
@@ -85,7 +85,7 @@ export function addPeriodSubCommands(
|
||||
.addSubcommand((option) =>
|
||||
extra(
|
||||
option
|
||||
.setName(strings.bot.common.subcommands[30].$)
|
||||
.setName(strings.bot.common.subcommands[30].name)
|
||||
.setNameLocalizations(subcommandNameLocalizations[30])
|
||||
.setDescription(strings.bot.common.subcommands[30].description)
|
||||
.setDescriptionLocalizations(subcommandDescriptionLocalizations[30]),
|
||||
@@ -94,7 +94,7 @@ export function addPeriodSubCommands(
|
||||
.addSubcommand((option) =>
|
||||
extra(
|
||||
option
|
||||
.setName(strings.bot.common.subcommands[60].$)
|
||||
.setName(strings.bot.common.subcommands[60].name)
|
||||
.setNameLocalizations(subcommandNameLocalizations[60])
|
||||
.setDescription(strings.bot.common.subcommands[60].description)
|
||||
.setDescriptionLocalizations(subcommandDescriptionLocalizations[60]),
|
||||
@@ -103,7 +103,7 @@ export function addPeriodSubCommands(
|
||||
.addSubcommand((option) =>
|
||||
extra(
|
||||
option
|
||||
.setName(strings.bot.common.subcommands[90].$)
|
||||
.setName(strings.bot.common.subcommands[90].name)
|
||||
.setNameLocalizations(subcommandNameLocalizations[90])
|
||||
.setDescription(strings.bot.common.subcommands[90].description)
|
||||
.setDescriptionLocalizations(subcommandDescriptionLocalizations[90]),
|
||||
@@ -112,7 +112,7 @@ export function addPeriodSubCommands(
|
||||
.addSubcommand((option) =>
|
||||
extra(
|
||||
option
|
||||
.setName(strings.bot.common.subcommands.career.$)
|
||||
.setName(strings.bot.common.subcommands.career.name)
|
||||
.setNameLocalizations(subcommandNameLocalizations.career)
|
||||
.setDescription(strings.bot.common.subcommands.career.description)
|
||||
.setDescriptionLocalizations(
|
||||
@@ -123,7 +123,7 @@ export function addPeriodSubCommands(
|
||||
.addSubcommand((option) =>
|
||||
extra(
|
||||
option
|
||||
.setName(strings.bot.common.subcommands.custom.$)
|
||||
.setName(strings.bot.common.subcommands.custom.name)
|
||||
.setNameLocalizations(subcommandNameLocalizations.custom)
|
||||
.setDescription(strings.bot.common.subcommands.custom.description)
|
||||
.setDescriptionLocalizations(
|
||||
@@ -131,7 +131,7 @@ export function addPeriodSubCommands(
|
||||
)
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.common.subcommands.custom.options.start.$)
|
||||
.setName(strings.bot.common.subcommands.custom.options.start.name)
|
||||
.setDescription(
|
||||
strings.bot.common.subcommands.custom.options.start.description,
|
||||
)
|
||||
@@ -139,7 +139,7 @@ export function addPeriodSubCommands(
|
||||
)
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName(strings.bot.common.subcommands.custom.options.end.$)
|
||||
.setName(strings.bot.common.subcommands.custom.options.end.name)
|
||||
.setDescription(
|
||||
strings.bot.common.subcommands.custom.options.end.description,
|
||||
)
|
||||
|
||||
@@ -11,10 +11,10 @@ export function addRegionChoices(option: SlashCommandStringOption) {
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
|
||||
return option
|
||||
.setName(strings.bot.common.options.region.$)
|
||||
.setName(strings.bot.common.options.region.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.region.$,
|
||||
(strings) => strings.bot.common.options.region.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -6,10 +6,10 @@ export function addTankChoices(option: SlashCommandStringOption) {
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
|
||||
return option
|
||||
.setName(strings.bot.common.options.tank.$)
|
||||
.setName(strings.bot.common.options.tank.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.tank.$,
|
||||
(strings) => strings.bot.common.options.tank.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -13,10 +13,10 @@ export function addTierChoices(option: SlashCommandStringOption) {
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
|
||||
return option
|
||||
.setName(strings.bot.common.options.tier.$)
|
||||
.setName(strings.bot.common.options.tier.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.tier.$,
|
||||
(strings) => strings.bot.common.options.tier.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -6,10 +6,10 @@ export function addUsernameChoices(option: SlashCommandStringOption) {
|
||||
const { strings } = translator(Locale.EnglishUS);
|
||||
|
||||
return option
|
||||
.setName(strings.bot.common.options.username.$)
|
||||
.setName(strings.bot.common.options.username.name)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.common.options.username.$,
|
||||
(strings) => strings.bot.common.options.username.name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
|
||||
@@ -35,8 +35,8 @@ export async function autocompleteTanks(
|
||||
{
|
||||
keys: [
|
||||
...SUPPORTED_LOCALES.map((locale) => [
|
||||
`searchableName.${locale}`,
|
||||
`searchableNameDeburr.${locale}`,
|
||||
`searchableName.{locale}`,
|
||||
`searchableNameDeburr.{locale}`,
|
||||
]).flat(),
|
||||
'camouflages',
|
||||
],
|
||||
|
||||
@@ -33,7 +33,7 @@ export function createLocalizedCommand(
|
||||
.setName(command)
|
||||
.setNameLocalizations(
|
||||
localizationObject(
|
||||
(strings) => strings.bot.commands[commandPathItem].$,
|
||||
(strings) => strings.bot.commands[commandPathItem].name,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
@@ -52,9 +52,9 @@ export function createLocalizedCommand(
|
||||
(strings) =>
|
||||
(
|
||||
strings.bot.commands[commandPathItem] as unknown as {
|
||||
subcommands: Record<string, { $: string }>;
|
||||
subcommands: Record<string, { name: string }>;
|
||||
}
|
||||
).subcommands[subItem.subcommand].$,
|
||||
).subcommands[subItem.subcommand].name,
|
||||
undefined,
|
||||
true,
|
||||
);
|
||||
@@ -87,9 +87,9 @@ export function createLocalizedCommand(
|
||||
(strings) =>
|
||||
(
|
||||
strings.bot.commands[commandPathItem] as unknown as {
|
||||
groups: Record<string, { $: string }>;
|
||||
groups: Record<string, { name: string }>;
|
||||
}
|
||||
).groups[subItem.group].$,
|
||||
).groups[subItem.group].name,
|
||||
undefined,
|
||||
true,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user