Closed lijiarui closed 7 years ago
Could it be possible that true is misspelt as trues - as mentioned in stack trace? :)
sorry for the typos error, I pasted wrong error.... The error is TypeError: cb is not a function
and I just modified the log in the issue.
Thanks for @silentrob
I think your function signature is not defining the bool you are passing in. It should be 'test=function (bool,cb){...}'
I use the following function and all works well.
exports.test = async function test(bool, cb) {
const content = this.message.original
console.log(content)
if (content === 'test') {
cb(null, true)
} else {
cb(null, false)
}
}
Sorry here again... The same code as follows:
+ *
- {^test(true)} yes it is test.
- {^test(false)} no, you are wrong.
exports.test = async function test(bool, cb) {
const content = this.message.original
if (content === 'test') {
cb(null, true)
} else {
cb(null, false)
}
}
It doesn't occur error, and if I send test
, all goes well, it return yes it is test
But when I send other words like hhhh
, I expected to get no, you are wrong
.
But I got null reply, json as follows:
{
"message": "",
"reply": {
"replyId": null,
"createdAt": 1496538340005,
"string": "",
"topicName": null,
"subReplies": [],
"debug": {
"user_id": "user1",
"raw_input": "test2",
"normalized_input": "test2",
"matched_gambit": [],
"timestamp": "2017-06-04T01:05:38.998Z"
}
}
}
It seems duplicate with issue 316
I found this
+ *
- {^myName("Ben")} a
- {^myName("Rob")} b
- {^myName("Alice")} ^saveSomething(<cap1>)
- {^myName("David")} ^doSomething() c
So how could I write function myName()
to post Ben
?
Changing the plugin to:
exports.test = function(bool, cb) {
const content = this.message.original
if (content === 'test') {
cb(null, bool === 'true')
} else {
cb(null, bool === 'false')
}
}
and the main.ss file to:
+ *
- {^test("true")} yes it is test.
- {^test("false")} no, you are wrong.
Makes filtering work again.
@duffrind Oh! Thanks, it works!
Using filter to filter out replies as wiki filter example to filter out replies but failed.
Expected Behavior
using the following script:
test() as follows:
when I type
test
I wish it will returnhow are you
Current Behavior
When I type
test
it occurs the following errorPossible Solution
When I try the following script: (change
- {^test(true)} how are you
to- {^test()} how are you
)It works well.
So I feel confused about this, because wiki shows as follows, it use
{^functionX(true)}
instead of{^functionX()}
Need some help, Thanks!