application didn't respond error on /cmd

this is my code
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('vouch')
.setDescription('Allows a user to vouch')
.addStringOption(option =>
option.setName("rating")
.setDescription("select :star: rating")
.setRequired(true)
.addChoices(
{ name: ":star:", value: ":star:" },
{ name: ":star::star:", value: ":star::star:" },
{ name: ":star::star::star:", value: ":star::star::star:" },
{ name: ":star::star::star::star:", value: ":star::star::star::star:" },
{ name: ":star::star::star::star::star:", value: ":star::star::star::star::star:" },
)
)
.addStringOption(option =>
option.setName("review")
.setDescription("write review")
),
async execute(interaction) {
console.log("response");
const review = interaction.options.getString('review');
const rating = interaction.options.getString('rating');
console.log(review, rating);
const vouchembed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle(`Vouched by ${message.author}`)
.setDescription(`**Rating:** ${rating}`)
.addFields(
{ name: "Review", value: review }
);
await interaction.Reply({ embeds: [vouchembed] }):
}
}
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('vouch')
.setDescription('Allows a user to vouch')
.addStringOption(option =>
option.setName("rating")
.setDescription("select :star: rating")
.setRequired(true)
.addChoices(
{ name: ":star:", value: ":star:" },
{ name: ":star::star:", value: ":star::star:" },
{ name: ":star::star::star:", value: ":star::star::star:" },
{ name: ":star::star::star::star:", value: ":star::star::star::star:" },
{ name: ":star::star::star::star::star:", value: ":star::star::star::star::star:" },
)
)
.addStringOption(option =>
option.setName("review")
.setDescription("write review")
),
async execute(interaction) {
console.log("response");
const review = interaction.options.getString('review');
const rating = interaction.options.getString('rating');
console.log(review, rating);
const vouchembed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle(`Vouched by ${message.author}`)
.setDescription(`**Rating:** ${rating}`)
.addFields(
{ name: "Review", value: review }
);
await interaction.Reply({ embeds: [vouchembed] }):
}
}
17 Replies
d.js toolkit
d.js toolkit11mo 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!
treble/luna
treble/luna11mo ago
and where are you calling that execute function that code should error because you didnt define message
xgenius
xgeniusOP11mo ago
I gotta call it?
treble/luna
treble/luna11mo ago
yes It won't magically call itself
xgenius
xgeniusOP11mo ago
oh
treble/luna
treble/luna11mo ago
also, interaction.Reply doesnt exist js is case sensitive
xgenius
xgeniusOP11mo ago
where do I need to call it?
treble/luna
treble/luna11mo ago
in your command handler Or wherever you receive your interactionCreate event
xgenius
xgeniusOP11mo ago
I'm new to js I was looking for a mention method I looked up it just showed message.author
treble/luna
treble/luna11mo ago
I would recommend learning the basics first then because you cant define things by pulling them out of thin air Thats not how it works #resources
xgenius
xgeniusOP11mo ago
I'm intermediate in py so ik ctx.author.mention, not for this...
treble/luna
treble/luna11mo ago
then learn js first, #rules 3 #resources
xgenius
xgeniusOP11mo ago
I see
treble/luna
treble/luna11mo ago
Interactions arent messages
xgenius
xgeniusOP11mo ago
what's the main problem here? I need to call exec func?
treble/luna
treble/luna11mo ago
yes, and yhe other things i mentioned But if you dotn have any js experience this isnt gonna work
xgenius
xgeniusOP11mo ago
I just usually do hit and trial. not very good learning method but helps ty for helping
Want results from more Discord servers?
Add your server