mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 20:49:52 +01:00
fix: tank id/index mismatch
This commit is contained in:
1 parent
16afa8c2d4
commit
7e0a2e88ee
2 files changed
+6
-4
No files matched your search
@@ -40,13 +40,15 @@ export const TANK_NAMES = new Promise<string[]>(async (resolve) => {
|
|||||||
export const TANK_NAMES_DIACRITICS = TANK_NAMES.then((tankNames) =>
|
export const TANK_NAMES_DIACRITICS = TANK_NAMES.then((tankNames) =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
tankNames.map(async (tankName, index) => {
|
tankNames.map(async (tankName, index) => {
|
||||||
const name = tankName ?? `Unknown Tank ${(await TANKS)[index].tank_id}`;
|
const id = (await TANKS)[index].tank_id;
|
||||||
|
const name = tankName ?? `Unknown Tank ${id}`;
|
||||||
const diacriticless = deburr(name);
|
const diacriticless = deburr(name);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
original: name,
|
original: name,
|
||||||
diacriticless,
|
diacriticless,
|
||||||
combined: `${name}${diacriticless}`,
|
combined: `${name}${diacriticless}`,
|
||||||
|
id,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
CacheType,
|
CacheType,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { go } from 'fuzzysort';
|
import { go } from 'fuzzysort';
|
||||||
import { TANKS, TANK_NAMES_DIACRITICS } from '../blitz/tankopedia';
|
import { TANK_NAMES_DIACRITICS } from '../blitz/tankopedia';
|
||||||
|
|
||||||
export default async function autocompleteTanks(
|
export default async function autocompleteTanks(
|
||||||
interaction: AutocompleteInteraction<CacheType>,
|
interaction: AutocompleteInteraction<CacheType>,
|
||||||
@@ -19,10 +19,10 @@ export default async function autocompleteTanks(
|
|||||||
keys: ['combined'],
|
keys: ['combined'],
|
||||||
limit: 10,
|
limit: 10,
|
||||||
}).map(
|
}).map(
|
||||||
async (item, index) =>
|
async (item) =>
|
||||||
({
|
({
|
||||||
name: item.obj.original,
|
name: item.obj.original,
|
||||||
value: `${(await TANKS)[index].tank_id}`,
|
value: `${item.obj.id}`,
|
||||||
}) satisfies ApplicationCommandOptionChoiceData<string>,
|
}) satisfies ApplicationCommandOptionChoiceData<string>,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user