Locale Descriptions

Hey I'm currently trying to use locale description with my bot. I have following code which is not working:
slashCommands.push({
name: slashCommand.name,
description: slashCommand.description,
descriptionLocalizations: slashCommand.descriptionLocalizations ? slashCommand.descriptionLocalizations : null,
type: slashCommand.type,
options: slashCommand.options ? slashCommand.options : null,
default_permission: slashCommand.default_permission ? slashCommand.default_permission : null,
default_member_permissions: slashCommand.default_member_permissions ? PermissionsBitField.resolve(slashCommand.default_member_permissions).toString() : null
});
slashCommands.push({
name: slashCommand.name,
description: slashCommand.description,
descriptionLocalizations: slashCommand.descriptionLocalizations ? slashCommand.descriptionLocalizations : null,
type: slashCommand.type,
options: slashCommand.options ? slashCommand.options : null,
default_permission: slashCommand.default_permission ? slashCommand.default_permission : null,
default_member_permissions: slashCommand.default_member_permissions ? PermissionsBitField.resolve(slashCommand.default_member_permissions).toString() : null
});
`
await rest.put(
GUILD_ID ?
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID) :
Routes.applicationCommands(CLIENT_ID),
{ body: slashCommands }
);
await rest.put(
GUILD_ID ?
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID) :
Routes.applicationCommands(CLIENT_ID),
{ body: slashCommands }
);
imports:
const { PermissionsBitField } = require('discord.js');
const { Routes } = require('discord-api-types/v9');
const { REST } = require('@discordjs/rest')
const { PermissionsBitField } = require('discord.js');
const { Routes } = require('discord-api-types/v9');
const { REST } = require('@discordjs/rest')
dependencies:
"@discordjs/rest": "^0.4.0-dev.1648166871.cedd053",
"discord-api-types": "^0.30.0",
"discord.js": "^14.12.1",
"@discordjs/rest": "^0.4.0-dev.1648166871.cedd053",
"discord-api-types": "^0.30.0",
"discord.js": "^14.12.1",
2 Replies
d.js toolkit
d.js toolkit9mo 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! - Marked as resolved by OP
Black_Wither
Black_WitherOP9mo ago
The locale translation Here is a example slash command:
3|sc_ideas | {
3|sc_ideas | name: 'help',
3|sc_ideas | description: 'Shows you all commands',
3|sc_ideas | descriptionLocalizations: { de: 'Zeigt dir alle Befehle an' },
3|sc_ideas | cooldown: 3000,
3|sc_ideas | type: 1,
3|sc_ideas | options: [],
3|sc_ideas | run: [AsyncFunction: run]
3|sc_ideas | }
3|sc_ideas | {
3|sc_ideas | name: 'help',
3|sc_ideas | description: 'Shows you all commands',
3|sc_ideas | descriptionLocalizations: { de: 'Zeigt dir alle Befehle an' },
3|sc_ideas | cooldown: 3000,
3|sc_ideas | type: 1,
3|sc_ideas | options: [],
3|sc_ideas | run: [AsyncFunction: run]
3|sc_ideas | }
But it makes no difference whether my language is set to German or English, only the normal description comes I fixed it 🤓 the option is description_localization not descriptionLocalization
slashCommands.push({
name: slashCommand.name,
description: slashCommand.description,
description_localizations: {de: "Test"},//slashCommand.descriptionLocalizations ? slashCommand.descriptionLocalizations : null,
type: slashCommand.type,
options: slashCommand.options ? slashCommand.options : null,
default_permission: slashCommand.default_permission ? slashCommand.default_permission : null,
default_member_permissions: slashCommand.default_member_permissions ? PermissionsBitField.resolve(slashCommand.default_member_permissions).toString() : null
});
slashCommands.push({
name: slashCommand.name,
description: slashCommand.description,
description_localizations: {de: "Test"},//slashCommand.descriptionLocalizations ? slashCommand.descriptionLocalizations : null,
type: slashCommand.type,
options: slashCommand.options ? slashCommand.options : null,
default_permission: slashCommand.default_permission ? slashCommand.default_permission : null,
default_member_permissions: slashCommand.default_member_permissions ? PermissionsBitField.resolve(slashCommand.default_member_permissions).toString() : null
});
Want results from more Discord servers?
Add your server