-
Notifications
You must be signed in to change notification settings - Fork 146
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
how to receive case-insensitive arguments in rivescipt #312
Comments
if you look back in the issues there was a lot of discussion on this. generally for 99% of chatbot inputs, we had a problem where content authors would type case sensitive things and it wouldn't match.
rivescript expects all triggers to be in lower case so the capitalized |
@dcsan Thanks for the response. Is there a work-around for this? |
@hark444 In my project, I capture the input first (before giving it to the RS engine) and set it as a uservar before having the engine reply. Since a uservar can be set with persistent case, you can then access it in RiveScript later as a case-sensitive string. I don't know if it's sufficient for your use case, but, as a very simple example: someInputElement.addEventListener('change', (event) => {
const message = event.target.value;
engine.setUservar('kjleitz', 'originalmessage', message);
engine.reply('kjleitz', message);
});
engine.setSubroutine('check-password', (_rs, [password, ..._args]) => {
// 'pAs$w0RD' would normally be turned into 'pasw0rd' if you passed it via <star>,
// but if you pass it via <get originalmessage> it'll keep the caps and special chars
return password === 'pAs$w0RD';
});
user: Let me in! |
I want to change a password through a service called by RiveScript.
So, while getting the current password from user, RiveScript converts everything to lowercase.
Is there anyway we can retrieve case-insensitive arguments in RiveScript.
The text was updated successfully, but these errors were encountered: