-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot add user option when using localizations #10347
Comments
Please show what you are doing with this builder (what you did with this builder to get that error). |
I just load it, everything works fine until i add translations for a user option private async loadCommands() {
const commandFiles = this.findCommandFiles();
for (const file of commandFiles) {
const command = await import(`../commands/${file}`);
const commandInstance = new command.default();
const commandCategory = (file as string).split('/')[0];
const commandData = {
...commandInstance.data,
category: commandCategory,
};
commandInstance.data = commandData;
client.commands.set(commandInstance.data.name, commandInstance);
}
client.on('ready', () => {
client.application?.commands.set(
client.commands.map((c) => c.data),
);
});
} |
This is a code sample from your comments. It works: import { Client, SlashCommandBuilder } from "discord.js";
const client = new Client({ intents: 0 });
client.on("ready", async () => {
const command = new SlashCommandBuilder()
.setName("info")
.setDescription("Shows information")
.setDescriptionLocalizations({
pl: "Pokazuje informacje",
})
.addSubcommand((subcommand) =>
subcommand
.setName("user")
.setDescription("Shows information about the user")
.setDescriptionLocalizations({
pl: "Pokazuje informacje o użytkowniku",
})
.addUserOption((option) =>
option
.setName("user")
.setNameLocalizations({
pl: "użytkownik",
})
.setDescription("The user to show information about")
.setDescriptionLocalizations({
pl: "Użytkownik, o którym chcesz zobaczyć informacje",
}),
),
);
await client.application!.commands.set([command]); // No error.
});
client.login(); So, you seem to have flawed logic in your code and this is not a discord.js issue. You can head to our support server where you'll get support much quicker. |
Which package is this bug report for?
discord.js
Issue description
SlashCommandBuilder
with a subcommand and user option.Code sample
Versions
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
User, Channel, GuildMember, Message, Reaction, GuildScheduledEvent, ThreadMember
Which gateway intents are you subscribing to?
Guilds, GuildMembers, GuildModeration, GuildEmojisAndStickers, GuildIntegrations, GuildWebhooks, GuildInvites, GuildVoiceStates, GuildPresences, GuildMessages, GuildMessageReactions, GuildMessageTyping, DirectMessages, DirectMessageReactions, DirectMessageTyping, MessageContent, GuildScheduledEvents, AutoModerationConfiguration, AutoModerationExecution, GuildMessagePolls, DirectMessagePolls
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: