Filters cannot filter out replies as expect
See original GitHub issueUsing filter to filter out replies as wiki filter example to filter out replies but failed.
Expected Behavior
using the following script:
+ *
- {^test(true)} how are you
- hello
test() as follows:
exports.test = async function test(cb) {
const content = this.message.original
console.log(content)
if (content === 'test') {
cb(null, true)
} else {
cb(null, false)
}
}
when I type test
I wish it will return how are you
Current Behavior
When I type test
it occurs the following error
/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.0.2@ss-parser/lib/wordnet.js:28
throw err;
^
TypeError: cb is not a function
at Object.test (/Users/lijiarui/Dropbox/git/superscript/myBotName/plugins/index.plugins.js:46:9)
at /Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/utils.js:114:29
at new Promise (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.0.22.2@es6-shim/es6-shim.js:1452:9)
at Object.<anonymous> (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/utils.js:109:12)
at Generator.next (<anonymous>)
at step (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/utils.js:25:191)
at /Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/utils.js:25:437
at new Promise (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.0.22.2@es6-shim/es6-shim.js:1452:9)
at Object.<anonymous> (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/utils.js:25:99)
at Object.runPluginFunc (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/utils.js:119:17)
at /Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/getReply/filterFunction.js:52:47
at Generator.next (<anonymous>)
at step (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/getReply/filterFunction.js:27:191)
at /Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.1.1.0@superscript/lib/bot/getReply/filterFunction.js:27:361
at /Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.0.22.2@es6-shim/es6-shim.js:1409:18
at Immediate.<anonymous> (/Users/lijiarui/Dropbox/git/superscript/myBotName/node_modules/.0.22.2@es6-shim/es6-shim.js:1382:26)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
Possible Solution
When I try the following script: (change - {^test(true)} how are you
to - {^test()} how are you
)
+ *
- {^test()} how are you
- hello
It works well.
So I feel confused about this, because wiki shows as follows, it use {^functionX(true)}
instead of {^functionX()}
+ i am *1
- {^functionX(true)} Yes, you are <cap>.
- {^functionX(false)} You’re lying, you’re not <cap>!
Need some help, Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
Google Analytics Filter Not Working? (Here's How To Fix It)
Incorrect RegEx. Another reason your Filter may not be working is that you haven't formatted it correctly. For example, when you're filtering ...
Read more >Filters not working as expected - WordPress.org
Hi There, The plugin is not working as expected. On a category page, the tag filter does not filter by the tags available...
Read more >Filtering Responses - Qualtrics
Your filter field would be your satisfaction question, your operator would be “Not equal to,” and your operand would be “extremely satisfied.” a...
Read more >Solved: Measure not filtering as expected - Microsoft Power BI ...
I altered your measure a little bit, and it works! This is the measure I ended up using: KPI = CALCULATE(( COUNT(Table[Brief Description...
Read more >About view filters - Analytics Help - Google Support
Use filter verification to make sure your filters are performing as expected before applying them to your incoming data.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Changing the plugin to:
and the main.ss file to:
Makes filtering work again.
@duffrind Oh! Thanks, it works!