Precondition not triggering "chatInputCommandDenied"
I have setup the following precondition:
Solution:Jump to solution
Ah I also see where you're going wrong here. Yes you land on the breakpoint for
this.error
, however because you're using Array#forEach
which accepts a callback function that returns void
you're not actually returning this.error
for the function chatInputRun
but rather for the anonymous arrow function that is provided to Array#forEach
.
You can solve this by using for...of
instead....4 Replies
ValidAutocompletedObjectIdArguments.ts
However, my chatInputCommandDenied
listener isn't firing:
ChatInputCommandDenied.ts
I know for a fact that the precondition is firing & returning an error in my test, as I've added a breakpoint to the return this.error (...)
statement
And here's the setting of the precondition on the command:
CMServerDefaults.ts
FYI if youu name the file
chatInputCommandDenied
(camel cased) then you dont need to set the event property at all anymore and you can fully omit the constructor.
Alternatively you can also use the enum that you already use as a type instead of the hard coded string: event: Events.ChatInputCommandDenied
Solution
Ah I also see where you're going wrong here. Yes you land on the breakpoint for
this.error
, however because you're using Array#forEach
which accepts a callback function that returns void
you're not actually returning this.error
for the function chatInputRun
but rather for the anonymous arrow function that is provided to Array#forEach
.
You can solve this by using for...of
instead.Oh man. Of course... what a rookie mistake! Thank you, this fixed it!