Uso el módulo para crear el comando y luego quiero usar el masaje incrustado allí. Ahí está mi código
const { MessageEmbed } = require('discord.js') module.exports = { data: new SlashCommandBuilder() .setName('info') .setDescription('Check info'), data: new MessageEmbed() .setTitle('Hello'), async execute(interaction) { await interaction.reply(`User info ${interaction.user.tag}\n Userid${interaction.user.id}\n Create Time ${interaction.user.createdAt}`); }, }
Cuando ejecuto el comando, obtengo esto. ¿Cómo puedo solucionarlo?
0.name[BASE_TYPE_REQUIRED]: This field is required 0.type[NUMBER_TYPE_COERCE]: Value "rich" is not int. rawError: { code: 50035, errors: { '0': [Object] }, message: 'Invalid Form Body' }
Puedes probar esto:
const { MessageEmbed } = require('discord.js') module.exports = { data: new SlashCommandBuilder() .setName('info') .setDescription('Check info'), async execute(interaction) { let embed = new MessageEmbed() .setTitle("Title...") .setDescription("Description...") await interaction.reply({ embeds: [embed] }); }, }
Está declarando la clave data
dos veces, que es probablemente lo que no quiere hacer. Prueba esto:
const { MessageEmbed } = require('discord.js') module.exports = { data: new SlashCommandBuilder() .setName('info') .setDescription('Check info'), async execute(interaction) { await interaction.reply({ embeds: [ new MessageEmbed().setTitle("Title").setDescription("Description...") ] }); }, }