Closed BushEdT closed 2 years ago
I tested your code and discord allows me to give that JSON to the API. Option type 1
isn't an error, that's the type for a subcommand, which is what you specified in your builder. The nested options properly show 3
for string.
Test code:
const command = new SlashCommandBuilder()
.setName('test')
.setDescription('Test')
.addSubcommand((cmd) =>
cmd
.setName('subcommand')
.setDescription('Test subcommand')
.addStringOption((option) =>
option.setName('option').setDescription('Option').setRequired(true)
)
);
(async function main() {
...
client.on('ready', async (readyClient) => {
const thing = await readyClient.application?.commands.create(
command.toJSON()
);
});
})();
I am sorry about that, I didn't have .toJSON()
🤦
It should tell us that it needs it tho...
Thank you !
Issue description
Create
new SlashCommandBuilder
then.addSubcommand
->
addStringOption
returns1
instead ofSTRING
It will throws an error :
Re-do same thing but with a
ApplicationCommandDataResolvable const
and it will work as intended :Thank you Edward T. Bush
Code sample
@discordjs/builders version
0.11.0
Node.js version
v16.13.1
Operating system
Windows 10
Priority this issue should have
Medium (should be fixed soon)