interface ShopItem {
name: string;
type: "aircraft" | "hangar";
size?: string;
price: number;
}
const combinedShop: ShopItem[] = [];
for (const hangar of hangarShop) {
combinedShop.push({
name: hangar.name,
type: "hangar",
size: hangar.type,
price: hangar.price,
});
}
for (const aircraft of aircraftShop) {
combinedShop.push({
name: aircraft.name,
type: "aircraft",
price: aircraft.price,
});
}
const choices = combinedShop.map((item) => ({
name: item.name,
value: item.name,
}));
.addSubcommand((command) =>
command
.setName("buy")
.setDescription("Buy an item from the shop")
.addStringOption((option) =>
option
.setName("item")
.setDescription("An item to purchase")
.setRequired(true)
.addChoices(...choices)
)
)
interface ShopItem {
name: string;
type: "aircraft" | "hangar";
size?: string;
price: number;
}
const combinedShop: ShopItem[] = [];
for (const hangar of hangarShop) {
combinedShop.push({
name: hangar.name,
type: "hangar",
size: hangar.type,
price: hangar.price,
});
}
for (const aircraft of aircraftShop) {
combinedShop.push({
name: aircraft.name,
type: "aircraft",
price: aircraft.price,
});
}
const choices = combinedShop.map((item) => ({
name: item.name,
value: item.name,
}));
.addSubcommand((command) =>
command
.setName("buy")
.setDescription("Buy an item from the shop")
.addStringOption((option) =>
option
.setName("item")
.setDescription("An item to purchase")
.setRequired(true)
.addChoices(...choices)
)
)