plugin-subcommands: subcommands with preconditions
HI, so im creating subcommands with preconditions, but its not working on subcommands, its only working on normal commands (chatInputCommands)
- When i run normal chatInputCommands, its working (first pic)
- But when i run subComands with preconditions (second pic)
- My subcommands code are like this (third pic)
- And my precondition are like this (fourth pic)
Solution:Jump to solution
the event name still has to be changed to
Subcommand
but that'd be a breaking change so it's pending whenever there is more 41 Replies
my filter command's preconditions placed like this
am i wrong doing it?
The application did not respond is correct because you did indeed not respond. Subcommand precondition violations do not go to the
chatInputCommandDenied
listener so you'll need to create a separate listener for them and reply accordingly. The fact that you get Application did not respond in fact means that the preconditions do work, you're just not handling it.
The correct listener for this is SubcommandPluginEvents.ChatInputSubcommandDenied
, which as parameters error: UserError, payload: ChatInputSubcommandDeniedPayload
so i need make new listener right?
for handling subcommandDenied
the listener still not running, or am i doing wrong again?
name of the file is the event, and the name is wrong. The name is
chatInputSubcommandDenied
not subCommandDenied
oooooo
okay sir
still the same
or because folder name?
folder name is irrelevant. Did you rebuild your TS code. Also make sure to delete dist, rebuilding TS doesn't delete old JS files.
oh actually I think it has to be
chatInputSubCommandDenied
yap
also i deleted the dist file
to make sure its newest
Solution
the event name still has to be changed to
Subcommand
but that'd be a breaking change so it's pending whenever there is more so now now
SubCommand
you can also set the event programmatically btw: https://www.sapphirejs.dev/docs/Guide/listeners/creating-your-own-listeners. Then you can just use the enum.i can do it, but i dont know who will emit the event
only
SubCommand
?, the folder name or the file name 1. it's always client unless otherwise specified
2. That option is optional anyway
file name
and not only
chatInputSubCommandDenied
like this?
umm, like this right?, but the emitter is client, and the event is
chatInputSubCommandDenied
or
Like I said, emitter is optional. It defaults to client
still nope
xD
SubCommand
I've typed that so many times now
capital C
oh I guess I made the mistake above
either way I still typed capital C so many times now
i searching for the capital c, and found nothing?, or im blinded
definitely are
unless your vscode filters out deprecated symbols in which case heck is that setting and I recommend changing it
ahhh, my vscode
found what are you mean
š
yap its working
isnt this the same?
look at the C in subcommand
no, i mean
yes, look at the C in subcommand
oooooooo
oke for now i hate c
wtf
C is a pretty garbage language yes /jk
yes, for me
xD
anyway I'll release a fix for this. It was pending a new major because removing an event and forcing users to change is a breaking change but screw it I can C this causes a lot of confusion
pun intended
yeah, its true for me, since its now really showed on ide
so after the release then there will be just 1 event called
chatInputSubcommandDenied
so with a lowercase c
2 hour because of "c"
ty sir @Favna