What's wrong with this slash command?

export default class ChemInfoCommand extends BaseCommand {
constructor() {
super(
new SlashCommandBuilder()
.setName("cheminfo")
.setDescription("Get information about a chemical")
.addStringOption((option) =>
option
.setName("Name")
.setDescription("Name of chemical compound")
.setRequired(false),
)
.addStringOption((option) =>
option
.setName("Formula")
.setDescription("Formula of chemical compound")
.setRequired(false),
)
.setDMPermission(true),
);
}
export default class ChemInfoCommand extends BaseCommand {
constructor() {
super(
new SlashCommandBuilder()
.setName("cheminfo")
.setDescription("Get information about a chemical")
.addStringOption((option) =>
option
.setName("Name")
.setDescription("Name of chemical compound")
.setRequired(false),
)
.addStringOption((option) =>
option
.setName("Formula")
.setDescription("Formula of chemical compound")
.setRequired(false),
)
.setDMPermission(true),
);
}
6 Replies
d.js toolkit
d.js toolkit•3mo 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! - ✅ Marked as resolved by OP
Piney
Piney•3mo ago
the slash command wont show up on my discord, but if i revert the slash command to what it was before the command shows up so smth is up with how i wrote this but i have no idea what
Syjalo
Syjalo•3mo ago
It should throw an error. Looks like you have a bad error handler Names can't contain upper case letters
Piney
Piney•3mo ago
? like the .setname? so .setName("name")
Syjalo
Syjalo•3mo ago
No, the string inside .setName("Name") .setName("Formula")
Piney
Piney•3mo ago
yep i got it thank you so much works now
Want results from more Discord servers?
Add your server