Skip to content
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

Misc low-hanging fruit, bug fixes and feature additions #154

Merged
merged 5 commits into from
Aug 8, 2016

Conversation

kirsle
Copy link
Member

@kirsle kirsle commented Aug 8, 2016

This knocks out various small annoying bugs and adds some quality-of-life features.

Fix Inline Redirects

This fixes a common annoying bug where an {@redirect} would fail if the author included a space between the @ and the trigger, for example {@ hello} vs. {@hello}.

The redirect text is stripped of whitespace before being looked up which resolves that issue.

Fixes #145

More Documentation

Adds more documentation to the rs.Promise function, including a full example of how to use replyAsync() in conjunction with the object macro returning a promise.

Also adds a link to the RiveScript Playground on the main README file.

Fixes #144

Optional Force Lowercasing of Triggers

This is a quality-of-life improvement for RiveScript authors who find it difficult to write the word i in lowercase for the sake of triggers (e.g. i am # years old).

This adds a forceCase option to the constructor which will force the parser to run all triggers through a .toLowerCase() function. This should work for ASCII based bots and make it easier on the authors, but the documentation mentions the caveats of Unicode case folding and this option is not enabled by default for the same reason.

Fixes #143
Fixes #69

Warnings with Hard Redirects

Here, a "hard redirect" refers to the top-level @Redirect command, as opposed to inline redirects with the {@} tag appearing in a reply-portion of RiveScript.

Hard redirects preempt all other commands, including -Reply and *Condition; when a trigger has a hard redirect, the redirect is immediately followed and everything else on the initial trigger is ignored. This can be surprising behavior for some.

During the parse phase, if an @Redirect command is found with siblings of -Reply or *Condition, a warning is given that you can't mix these mutually-exclusive commands.

It is not a fatal warning, and the behavior of the bot is not changed from before (the @Redirect will still preempt any replies/conditions), but it lets the bot master know that an error was found and they should fix it.

Fixes #58

@kirsle kirsle merged commit 7118763 into master Aug 8, 2016
@kirsle kirsle deleted the bug/misc-fixes branch August 8, 2016 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant