`MissingPropertyError` when making a select menu

I'm having a problem with making a StringSelectMenu; discord.js seems to insist that the menu I'm making is missing the label and value properties required of select menu options, but based on the builder, both of these should be there. My Code:
// DenyReasonMenuSelect.ts
import { StringSelectMenuBuilder } from "@discordjs/builders";
import { ISelectMenu } from "../interfaces/ISelectMenu.js";
import { AnySelectMenuInteraction, StringSelectMenuOptionBuilder } from "discord.js";


export class DenyReasonMenuSelect implements ISelectMenu {
public name = "deny_reason";

public menu: StringSelectMenuBuilder;

constructor(menuData?: string, valueData?: string) {
const menuId = "deny_reason" + (menuData ? `/${menuData}` : "");
const optionData = valueData ? `/${valueData}` : "";

this.menu = new StringSelectMenuBuilder()
.setCustomId(menuId)
.setPlaceholder("Reason for Denial")
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel("Locked")
.setDescription("The book cannot be accessed pubicily.")
.setValue("locked" + optionData),
);
}

public async execute(interaction: AnySelectMenuInteraction): Promise<void> {
interaction.reply("hello from deny reason menu select!");
}
}
// DenyReasonMenuSelect.ts
import { StringSelectMenuBuilder } from "@discordjs/builders";
import { ISelectMenu } from "../interfaces/ISelectMenu.js";
import { AnySelectMenuInteraction, StringSelectMenuOptionBuilder } from "discord.js";


export class DenyReasonMenuSelect implements ISelectMenu {
public name = "deny_reason";

public menu: StringSelectMenuBuilder;

constructor(menuData?: string, valueData?: string) {
const menuId = "deny_reason" + (menuData ? `/${menuData}` : "");
const optionData = valueData ? `/${valueData}` : "";

this.menu = new StringSelectMenuBuilder()
.setCustomId(menuId)
.setPlaceholder("Reason for Denial")
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel("Locked")
.setDescription("The book cannot be accessed pubicily.")
.setValue("locked" + optionData),
);
}

public async execute(interaction: AnySelectMenuInteraction): Promise<void> {
interaction.reply("hello from deny reason menu select!");
}
}
The error it gives: (see attached file)
2 Replies
d.js toolkit
d.js toolkit•16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
tycoonlover1359
tycoonlover1359OP•16mo ago
I've been pondering this for literally HOURS... and it turns out to be a bad/wrong import 🫠 anyhow, thx
Want results from more Discord servers?
Add your server