Plugin subcommands: "No subcommand was matched with the provided command."
I configured my subcommands like this:
...and used the commands like this:
37 Replies
chat input error stack:
message run error stack:
here's how i register the chat input command:
I used:
@sapphire/framework
: v4.5.0
@sapphire/plugin-subcommands
: v4.0.1
discord.js
: v14.11.0
pls mention me if someone know the problem:/
what is the
[Function: messageRun]
here? Are they actually functions you implemented inline, or did you actually type that? Ideally they are names of other functions in the same class. Also make sure to not implement messageRun
/ chatInputRun
in those same classes.
Also you can use this.name
and this.description
its from console log dw
wait, you cant fill that with inline function?
you can, though not if supplied through the
@ApplyOptions
decorator iirc
most people dont use inline functions though I think. We kept it because Vladdy wanted that style.well, its pain to handle message and chat input separately, and i just passed the
message|chatinput
to the same function, so, the subcommand mapping value is an inline function that runs the same function and pass message, chatinput run, and args
yeah i didnt use thatwell at a glance your setup looks okay. Best thing you can do to find the cause is set a breakpoint at
node_modules/@sapphire/plugin-subcommands/dist/lib/Subcommand.js
line 188 then use a debugger to traverse through and check why it is not matching.ahh
🤔
why the subcommand group name is undefined?
uh wtf
try to do the same code?
interaction.options.getSubcommandGroup()
in the debugger console I meant
I should've added that immediatelyuh
its there
actually
this thing is empty
uh
is it possible to define
the subcommands
after super keyword
oh no it's not
did you dod that lol
yeah because i need to access
this
yeah thats the issue thenthis for ... the function I guess?
the function you mentioend to call
yeah
i can use the
yeah you'll have to extract it to outside the class and call it that way
named function
i can just pass the string instead of inline
Solution
actually this also works pretty sure:
at least TS doesnt complain
<:AW_KEKW:800014260787871744>
ok thanks
I think it works because the function is a callback that gets executed when it's called ....
gonna test this rq
need to move that thing lel
yeah that works
wait what
so just inline it all
you can call
this
from the function just fineOHH
i see
should be something like that for you I guess
oh yeah it works
cool