rivescript-js icon indicating copy to clipboard operation
rivescript-js copied to clipboard

"?" is not handled in the triggers

Open rblanc99 opened this issue 5 years ago • 2 comments
trafficstars

I am using Rivescript in a Node project.

I want to make the bot recognize questions, so i would like to do something like

+ * ? 
- {topic=questions}

But unfortunately, the bot can't handle the "?", I get a Triggers may only contain lowercase letters, numbers, and these symbols: ( | ) [ ] * _ # { } < > = / error.

I would very much appreciate that feature, thanks !

(Maybe this issue belongs in the rivescript repo and not rivescript-js, wasn't sure about it, sorry)

rblanc99 avatar Nov 29 '19 13:11 rblanc99

i think that because rivescript uses a simplified version of regex, this feature would be hard to support. the simpler form makes it really easy for non-tech authors to use, but means more sophisticated regex features are missing. there was some thought of adding true regex but not much requests for that right now. https://github.com/aichaos/rivescript-js/issues/320

dcsan avatar Nov 30 '19 08:11 dcsan

Perhaps an alternative way to detect questions is to look at the first word of the message?

+ (who|what|how|why|when) *
- {topic=questions}{@<star1> <star2>}

Alternatively, your bot code can look for the ? mark and set a user variable before calling reply().

kirsle avatar Dec 02 '19 18:12 kirsle