I don't understand what's going on

I'm trying to create a slash command, but every time I try I get the error shown in the screenshot below. Discord.js version: [email protected] Node.js version: [email protected] My code:
client.on("ready", () => {
console.log(`I'm alive at ${client.user.tag}!`);
const data = new SlashCommandBuilder()
.setName("user")
.setNameLocalization({"pt-BR": "usuário"})
.setDescription("Use to perform some action related to some user.")
.setDescriptionLocalization({"pt-BR": "Use para executar alguma ação relacionada a algum usuário."})

.addSubcommand(subcommand =>
subcommand
.setName("pic")
.setNameLocalization({"pt-BR": "foto"})
.setDescription("Use to get a user's profile picture.")
.setDescriptionLocalization({"pt-BR": "Use para obter a foto de perfil de um usuário."})
)

.setUserOption(option =>
option
.setRequired(false)
.setName("mention")
.setNameLocalization({"pt-BR": "mencionar"})
.setDescription("Mention a user.")
.setDescriptionLocalization({"pt-BR": "Mencione um usuário."})
)

.addStringOption(option =>
option
.setRequired(false)
.setName("privacy")
.setNameLocalization({"pt-BR": "privacidade"})
.setDescription("Should the execution of this command be hidden?")
.setDescriptionLocalization({"pt-BR": "A execução deste comando deve ser oculta?"})
.addChoices({
name: "Yes. This action must be performed particularly!",
name_localizations: {
"pt-BR": "Sim. Esta ação deve ser executada particularmente!"
},
value: "privacy_true"
},
{
name: "No. This action must be performed publicly!",
name_localizations: {
"pt-BR": "Não. Esta ação deve ser executada publicamente!"
},
value: "privacy_false"
}
)
)
});
client.on("ready", () => {
console.log(`I'm alive at ${client.user.tag}!`);
const data = new SlashCommandBuilder()
.setName("user")
.setNameLocalization({"pt-BR": "usuário"})
.setDescription("Use to perform some action related to some user.")
.setDescriptionLocalization({"pt-BR": "Use para executar alguma ação relacionada a algum usuário."})

.addSubcommand(subcommand =>
subcommand
.setName("pic")
.setNameLocalization({"pt-BR": "foto"})
.setDescription("Use to get a user's profile picture.")
.setDescriptionLocalization({"pt-BR": "Use para obter a foto de perfil de um usuário."})
)

.setUserOption(option =>
option
.setRequired(false)
.setName("mention")
.setNameLocalization({"pt-BR": "mencionar"})
.setDescription("Mention a user.")
.setDescriptionLocalization({"pt-BR": "Mencione um usuário."})
)

.addStringOption(option =>
option
.setRequired(false)
.setName("privacy")
.setNameLocalization({"pt-BR": "privacidade"})
.setDescription("Should the execution of this command be hidden?")
.setDescriptionLocalization({"pt-BR": "A execução deste comando deve ser oculta?"})
.addChoices({
name: "Yes. This action must be performed particularly!",
name_localizations: {
"pt-BR": "Sim. Esta ação deve ser executada particularmente!"
},
value: "privacy_true"
},
{
name: "No. This action must be performed publicly!",
name_localizations: {
"pt-BR": "Não. Esta ação deve ser executada publicamente!"
},
value: "privacy_false"
}
)
)
});
error
My settings
5 Replies
d.js toolkit
d.js toolkit16mo 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!
duck
duck16mo ago
setNameLocalization takes 2 string parameters, the locale and the name, not an object
d.js docs
d.js docs16mo ago
Makoto!
Makoto!OP16mo ago
Ohhh thx:3 It worked!
Makoto!
Makoto!OP16mo ago
Want results from more Discord servers?
Add your server