Open webfrank opened 7 years ago
@webfrank You'd have to enable utf8 when instantiating Rivescript i.e new Rivescript({ utf8: true })
Even so, the periods will be stripped out because of the unicodePunctuation
. There's a related bug and some discussion about it at https://github.com/aichaos/rivescript-go/issues/31.
If somebody wants to come up with the regexp described there and submit a pull request to either project, it can get fixed sooner and you'll help me with all the other RiveScript versions to get this change implemented everywhere.
As a hacky workaround, you could store the user's original message via rs.setUservar
before calling rs.reply[Async]
, and then deal with getting their email address from inside an object macro. You could recall the variable like rs.getUservar(rs.currentUser(), "rawMessage")
from inside an object macro, and then parse the email out yourself.
No they wouldn't be if you do this.
const bot = new Rivescript({ utf8: true })
bot.unicodePunctuation = new RegExp(/[~]/)
That's how I get around it. Basically tells it to only strip out ~
character which I never find myself needing
Is not possible to capture emails (containing @ and dots or dash) because messages are parsed by the function stripNasties which strips everything but a-zA-Z and space.