Could not pass a new instance of slash command builder to registry.registerApplicationCommands
I have found out that subcommand and subcommand group type is omitted when passing a newly instance of builder. When using the callback method it's not omitted 🤔
reproduction sample: https://github.com/yuanstuffs/registry-reproduction-sample
13 Replies

doing
builder.toJSON()
:
Same as registering subcommands.

subcommands and sub groups are being omitted
.
I am running a bot with subcommands just fine so i have no idea what is going wrong here.
GitHub
bloombot/src/commands/settings.ts at main · favware/bloombot
A private discord bot for the Nightbloom FC Discord server - favware/bloombot
Using the callback method have no issues, how about try making a new instance of the slash command builder class with subcommands and pass it to the register chat input command function
oh that's what you meant. hm yeah I think I reported before to @vladdy that passing an instance doesnt work properly
Have you figured this out with an instance?
I found the problem in the code itself
the problem lies in
@sapphire/framework/lib/utils/application-commands/normalizeInputs
. The builder passed is never recognized as a builder so it just goes thru trest of the code
I found the problem lool. I was using
SlashCommandBuilder
from Discord.js where the SlashCommandBuilder
instance check happens in @discordjs/builders
So in technicality builder from discord.js package and builder from builders package is not the same
For now, a fix is to import builders that are related to commands from @discordjs/builders
instead of discord.js
Can you check your lockfile see if you have 2 versions of builders? Because discordjs re-exports /builders and they should be identical. This is a bug I've known about but never figured out why.
they are two versions of them, but they are identical versions
Idk why Javascript treats an import from djs differently from builders