Name localization for Application Command Subcommands and Option Choices not included in JSON
See original GitHub issueWhich package is this bug report for?
builders
Issue description
Localization options do not seem to work for subcommand name (probably description as well, admittedly I haven’t checked), and subcommand option choice names.
Reproduction Steps
- Create a command and subcommand
- Add a string command option to the subcommand
- After defining the name, set or add the name localizations
- Export the command to JSON
Expected: The name localizations are present on the application command subcommand and option choices Actual: The name localizations are not present on the application command subcommand and option choices
Link to one place I think changes might need to happen. I’m pretty sure for the example linked there name_localizations
needs to be added to the choice destructuring and on the object that is pushed to the choices array.
JSON result of example code
{
"name":"test",
"name_localizations":{
"en-GB":"test"
},
"description":"Schedules an event in this channel",
"options":[
{
"type":1,
"name":"subcommand",
"description":"subcommand description",
"options":[
{
"choices":[
{
"name":"choice",
"value":"1"
}
],
"type":3,
"name":"option",
"name_localizations":{
"en-GB":"option"
},
"description":"option description",
"required":false
}
]
}
]
}
Code sample
import { InteractiveCommand } from './command';
import { SlashCommandBuilder } from '@discordjs/builders';
export const Test: InteractiveCommand = {
data: new SlashCommandBuilder()
.setName('test')
.setNameLocalization('en-GB', 'test')
.setDescription('Schedules an event in this channel')
.addSubcommand(subcommand =>
subcommand.setName('subcommand')
.setNameLocalization('en-GB', 'subcommand')
.setDescription('subcommand description')
.addStringOption(option =>
option.setName('option')
.setNameLocalization('en-GB', 'option')
.setDescription('option description')
.addChoices(...[{
name: 'choice',
name_localizations: {
'en-GB': 'choice'
},
value: '1'
}])
)
),
execute: async interaction => {},
handleMessageComponentInteraction: async interaction => {}
}
Package version
0.13.0
Node.js version
16.14.0
Operating system
WSL
Priority this issue should have
Medium (should be fixed soon)
Which partials do you have configured?
User, Channel, Message
Which gateway intents are you subscribing to?
Guilds
I have tested this issue on a development release
Not yet, I see how to install a discord.js
dev release, is it the same for the builders package?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Also thank you very much for the speedy fix! ❤️
Can you check again?
b911980
(#7862) should solve it