-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple commands using the same callback #70
Comments
so it seems you can put an array of commands to use the same callback |
Array commands are not actually supported (though they probably should be). See this comment on your other issue. |
Reopening to remind myself to add support for array commands. |
You sir, are what is known as a mensch |
One question though, how do you send the spoken command itself from the array as the callbacks argument? like this:
or like this:
or something else? will I still need to use the same solution you gave me in 3.3.0?
|
so this works:
There is only the issue, of, if multiple commands match the fuzzy requirements, all are called with the callback instead of the command which most closely matches. |
Ah yes, it would make sense to know which of the commands in the array was matched. I'll make a quick update. |
This is an interesting point. It may be desirable in some cases to just trigger the callback on the best match when fuzzy matching is used. If this would be a useful feature for you, let me know and I can look into it. |
Letting you know, this would be useful ;-) |
tried this. Did not work:
expected outout: |
I'll repro this and see what I can do. |
Initial tests indicate this issue is exclusive to fuzzy-matched commands. My bad for not testing that case when I made that release. Investigating. |
Ah wait, this does make sense. Fuzzy callbacks get three other arguments before that one. |
With fuzzy commands, you can use the first arg like before:
|
This does make me want to clean up the API a bit. Ideally, there would just be one object arg for both fuzzy and non-fuzzy commands, and the callback could unpack whatever it needed. It feels messy having Before I do that, I'm going to look into your request for "closest match wins" for fuzzy commands. |
What is the best way to do this, do I have to define multiple commands with the same callback, or can a command be an array of possible strings which will call the same callback?
The text was updated successfully, but these errors were encountered: