@SlashChoice(...tabletAreas)
@SlashOption({
type: ApplicationCommandOptionType.String,
name: "area",
description: "The area of the Lore Tablet",
required: true,
})
area: string,
@SlashOption({
autocomplete: async (interaction: AutocompleteInteraction) => {
const ChosenArea = interaction.options.getString("area");
const tabletNameAutocomplete: { name: string; value: string; }[] = [];
for (const tabletName of tabletList) {
if (tabletName.area === ChosenArea) {
tabletNameAutocomplete.push({ name: tabletName.name, value: tabletName.name });
}
}
const filtered = tabletNameAutocomplete.filter((c: { name: string; }) => capitalize(c.name).startsWith(capitalize(interaction.options.getFocused())));
await interaction.respond(
filtered.map(choice => ({ name: choice.name, value: choice.name })).slice(0, 25)
);
},
type: ApplicationCommandOptionType.String,
name: "name",
description: "The name of the Lore Tablet",
required: true,
})
@SlashChoice(...tabletAreas)
@SlashOption({
type: ApplicationCommandOptionType.String,
name: "area",
description: "The area of the Lore Tablet",
required: true,
})
area: string,
@SlashOption({
autocomplete: async (interaction: AutocompleteInteraction) => {
const ChosenArea = interaction.options.getString("area");
const tabletNameAutocomplete: { name: string; value: string; }[] = [];
for (const tabletName of tabletList) {
if (tabletName.area === ChosenArea) {
tabletNameAutocomplete.push({ name: tabletName.name, value: tabletName.name });
}
}
const filtered = tabletNameAutocomplete.filter((c: { name: string; }) => capitalize(c.name).startsWith(capitalize(interaction.options.getFocused())));
await interaction.respond(
filtered.map(choice => ({ name: choice.name, value: choice.name })).slice(0, 25)
);
},
type: ApplicationCommandOptionType.String,
name: "name",
description: "The name of the Lore Tablet",
required: true,
})