#Mention User Slash Command
26 messages · Page 1 of 1 (latest)
Code
module.exports = {
data: new SlashCommandBuilder()
.setName('teste')
.setDescription('Marque o Usuário !')
.addUserOption(option => option
.setName("user")
.setDescription('The user')
.setRequired(true)),
have you re-deployed your commands
you say unregister and register the command again ?
or just register again
yeah
yes but not work
and my command console return this
[
{
options: [],
name: 'teste',
name_localizations: undefined,
description: 'teste !',
description_localizations: undefined,
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined
}
]
doesn't look like updated
const commands = [
new SlashCommandBuilder().setName('teste').setDescription('teste !'),
]
.map(command => command.toJSON());
console.log(commands);
this code return me console above
do you see options here?
not
but i don't understand why my command has no entry to mention a user
maybe you are deploying them wrong
The error in the original code.addUserOption() method, which caused a syntax error. The correct syntax is to close the method call before closing the object literal with a curly brace }.
data: new SlashCommandBuilder()
.setName('teste')
.setDescription('Marque o Usuário !')
.addUserOption(option => option
.setName('user')
.setDescription('The user')
.setRequired(true)
)
};
yes
then change it
this is my full code
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('teste')
.setDescription('Marque o Usuário !')
.addUserOption(option => option
.setName("user")
.setDescription('The user')
.setRequired(true)),
async execute(interaction) {
const value = interaction.options.getUser("user");
const embed = new EmbedBuilder()
.setColor('272727')
.setTitle('Valor inserido')
.setDescription(`O valor inserido foi: **${value}**`);
await interaction.reply({ embeds: [embed] });
},
};
the code appears to be correct except for the use of EmbedBuilder instead of MessageEmbed which is the recommended builder for creating Embeds in the Discord.js v13 library.
new code: ```const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('teste')
.setDescription('Marque o Usuário !')
.addUserOption(option => option
.setName("user")
.setDescription('The user')
.setRequired(true)),
async execute(interaction) {
const value = interaction.options.getUser("user");
const embed = new MessageEmbed()
.setColor('272727')
.setTitle('Valor inserido')
.setDescription(`O valor inserido foi: **${value}**`);
await interaction.reply({ embeds: [embed] });
},
};
you can show me how ?
also make sure you are running discord.js on v13 version @dim pond
14.7.1
needs to be compatible with version v13