@sapphire/shapeshift ExpectedConstraintError

Hi all, currently creating a command with choices. Here's the code I wrote, but for some reason, this weird error pops up when applying ...choices to #addChoices
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)
)
)
[ERROR] Encountered error while handling the command application command registry for command "shop" at path "D:\Development\@airbridge\bot\src\commands\shop.ts" ExpectedConstraintError > s.number.lessThanOrEqual
Invalid number value

Expected: expected <= 25

Received:
| 34
[ERROR] Encountered error while handling the command application command registry for command "shop" at path "D:\Development\@airbridge\bot\src\commands\shop.ts" ExpectedConstraintError > s.number.lessThanOrEqual
Invalid number value

Expected: expected <= 25

Received:
| 34
Solution:
Maximum amount of options is 25
Jump to solution
5 Replies
Solution
Favna
Favna•2y ago
Maximum amount of options is 25
Favna
Favna•2y ago
You provided 34
Marino
MarinoOP•2y ago
oh Oops sorry I didn't read it properly facepalm
Favna
Favna•2y ago
@fenish example of very long question very short answer 😉 Relating back to our conversation of before
fenish
fenish•2y ago
xddd
Want results from more Discord servers?
Add your server