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 toolkit5mo 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/luna5mo ago
and where are you calling that execute function that code should error because you didnt define message
xgenius
xgenius5mo ago
I gotta call it?
treble/luna
treble/luna5mo ago
yes It won't magically call itself
xgenius
xgenius5mo ago
oh
treble/luna
treble/luna5mo ago
also, interaction.Reply doesnt exist js is case sensitive
xgenius
xgenius5mo ago
where do I need to call it?
treble/luna
treble/luna5mo ago
in your command handler Or wherever you receive your interactionCreate event
xgenius
xgenius5mo ago
I'm new to js I was looking for a mention method I looked up it just showed message.author
treble/luna
treble/luna5mo 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
xgenius5mo ago
I'm intermediate in py so ik ctx.author.mention, not for this...
treble/luna
treble/luna5mo ago
then learn js first, #rules 3 #resources
xgenius
xgenius5mo ago
I see
treble/luna
treble/luna5mo ago
Interactions arent messages
xgenius
xgenius5mo ago
what's the main problem here? I need to call exec func?
treble/luna
treble/luna5mo ago
yes, and yhe other things i mentioned But if you dotn have any js experience this isnt gonna work
xgenius
xgenius5mo ago
I just usually do hit and trial. not very good learning method but helps ty for helping