xgenius
xgenius
DIAdiscord.js - Imagine an app
Created by xgenius on 1/30/2024 in #djs-questions
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] }):
}
}
31 replies