Skip to content

Commit

Permalink
Prepare v2.2.0 for release
Browse files Browse the repository at this point in the history
  • Loading branch information
kirsle committed Oct 2, 2021
1 parent 0cb33d3 commit 30d176f
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 178 deletions.
31 changes: 31 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changes

## 2.2.0 - Oct 1 2021

This release includes various bugfixes and features from the GitHub
community.

There is a new algorithm for handling the nestable tags (such as
`<get>`, `<set>`, `<bot>`, and other variable getter/setter tags)
and it works with `<call>` tags, too! Thanks,
[@lee-orr](https://github.com/lee-orr)! (PR #377)

```
+ *
- <set value=<call>add_hello <star></call>>
^ The answer is: <get value>.
> object add_hello javascript
return "hello:" + args[0];
< object
```

- Bugfix: missing 'let' in for loop (#340)
- If an error is raised within an object macro, include the error in the
bot's response (#341)
- Fix a truthiness check for whether bot/env vars are 'undefined' (#350)
- Fix the _ word wildcard not working when multiple are in the same
trigger (#356)
- Add example: json-server-async (#207)
- An option to treat user inputs as case-sensitive instead of always
lowercasing them (#246/#378)
- Various Dependabot dependency updates.

## 2.1.0 - Mar 13 2020

- The RiveScript `shell.js` script is now installed as a command line program
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ The shell accepts a few command line parameters:
* `--watch`: watch the reply folder for changes and automatically reload the
bot when files are modified.
* `--utf8`: enables UTF-8 mode.
* `--case`: enable case-sensitive user messages.


## DOCUMENTATION
Expand Down
10 changes: 5 additions & 5 deletions docs/brain.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

Create a Brain object which handles the actual process of fetching a reply.

## async reply (string user, string msg[, scope]) -> string
## async reply (string user, string msg[, scope])

Fetch a reply for the user. This returns a Promise that may be awaited on.

## private async _getReply (string user, string msg, string context, int step, scope) -> string
## async _getReply (string user, string msg, string context, int step, scope)

The internal reply method. DO NOT CALL THIS DIRECTLY.

Expand All @@ -19,15 +19,15 @@ The internal reply method. DO NOT CALL THIS DIRECTLY.

Format a user's message for safe processing.

## async triggerRegexp (string user, string trigger) -> string
## async triggerRegexp (string user, string trigger)

Prepares a trigger for the regular expression engine.

## async processTags (string user, string msg, string reply, string[] stars, string[] botstars, int step, scope) -> string
## string processTags (string user, string msg, string reply, string[] stars, string[] botstars, int step, scope)

Process tags in a reply element.

## string substitute (string msg, string type)

Run substitutions against a message. `type` is either "sub" or "person" for
the type of substitution to run.
the type of substitution to run.
7 changes: 3 additions & 4 deletions docs/html/lang.coffee.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
<h1>CoffeeObjectHandler (RiveScript master)</h1>
<p>CoffeeScript Language Support for RiveScript Macros. This language is not
enabled by default; to enable CoffeeScript object macros:</p>
<div class="codehilite"><pre><span></span><span class="nv">CoffeeObjectHandler = </span><span class="nx">require</span> <span class="s">&quot;rivescript/lang/coffee&quot;</span>
<span class="nx">bot</span><span class="p">.</span><span class="nx">setHandler</span> <span class="s">&quot;coffee&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="nx">CoffeeObjectHandler</span>
</pre></div>

<pre class="codehilite"><code class="language-coffeescript">CoffeeObjectHandler = require &quot;rivescript/lang/coffee&quot;
bot.setHandler &quot;coffee&quot;, new CoffeeObjectHandler
</code></pre>

<h2>void load (string name, string[] code)</h2>
<p>Called by the RiveScript object to load CoffeeScript code.</p>
Expand Down
5 changes: 2 additions & 3 deletions docs/html/lang.javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ <h1>JSObjectHandler (RiveScript master)</h1>
<p>JavaScript Language Support for RiveScript Macros. This support is enabled by
default in RiveScript.js; if you don't want it, override the <code>javascript</code>
language handler to null, like so:</p>
<div class="codehilite"><pre><span></span><span class="nx">bot</span><span class="p">.</span><span class="nx">setHandler</span><span class="p">(</span><span class="s2">&quot;javascript&quot;</span><span class="p">,</span> <span class="kc">null</span><span class="p">);</span>
</pre></div>

<pre class="codehilite"><code class="language-javascript">bot.setHandler(&quot;javascript&quot;, null);
</code></pre>

<h2>void load (string name, string[]|function code)</h2>
<p>Called by the RiveScript object to load JavaScript code.</p>
Expand Down
67 changes: 33 additions & 34 deletions docs/html/parser.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,39 @@ <h1>Parser (RiveScript master)</h1>
<h2>object parse (string filename, string code[, func onError])</h2>
<p>Read and parse a RiveScript document. Returns a data structure that
represents all of the useful contents of the document, in this format:</p>
<div class="codehilite"><pre><span></span><span class="p">{</span>
<span class="s2">&quot;begin&quot;</span><span class="o">:</span> <span class="p">{</span> <span class="c1">// &quot;begin&quot; data</span>
<span class="s2">&quot;global&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// ! global vars</span>
<span class="s2">&quot;var&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// ! bot vars</span>
<span class="s2">&quot;sub&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// ! sub substitutions</span>
<span class="s2">&quot;person&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// ! person substitutions</span>
<span class="s2">&quot;array&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// ! array lists</span>
<span class="p">},</span>
<span class="s2">&quot;topics&quot;</span><span class="o">:</span> <span class="p">{</span> <span class="c1">// main reply data</span>
<span class="s2">&quot;random&quot;</span><span class="o">:</span> <span class="p">{</span> <span class="c1">// (topic name)</span>
<span class="s2">&quot;includes&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// included topics</span>
<span class="s2">&quot;inherits&quot;</span><span class="o">:</span> <span class="p">{},</span> <span class="c1">// inherited topics</span>
<span class="s2">&quot;triggers&quot;</span><span class="o">:</span> <span class="p">[</span> <span class="c1">// array of triggers</span>
<span class="p">{</span>
<span class="s2">&quot;trigger&quot;</span><span class="o">:</span> <span class="s2">&quot;hello bot&quot;</span><span class="p">,</span>
<span class="s2">&quot;reply&quot;</span><span class="o">:</span> <span class="p">[],</span> <span class="c1">// array of replies</span>
<span class="s2">&quot;condition&quot;</span><span class="o">:</span> <span class="p">[],</span> <span class="c1">// array of conditions</span>
<span class="s2">&quot;redirect&quot;</span><span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="c1">// @ redirect command</span>
<span class="s2">&quot;previous&quot;</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span> <span class="c1">// % previous command</span>
<span class="p">},</span>
<span class="p">...</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="s2">&quot;objects&quot;</span><span class="o">:</span> <span class="p">[</span> <span class="c1">// parsed object macros</span>
<span class="p">{</span>
<span class="s2">&quot;name&quot;</span><span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="c1">// object name</span>
<span class="s2">&quot;language&quot;</span><span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="c1">// programming language</span>
<span class="s2">&quot;code&quot;</span><span class="o">:</span> <span class="p">[],</span> <span class="c1">// object source code (in lines)</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
</pre></div>

<pre class="codehilite"><code class="language-javascript">{
&quot;begin&quot;: { // &quot;begin&quot; data
&quot;global&quot;: {}, // ! global vars
&quot;var&quot;: {}, // ! bot vars
&quot;sub&quot;: {}, // ! sub substitutions
&quot;person&quot;: {}, // ! person substitutions
&quot;array&quot;: {}, // ! array lists
},
&quot;topics&quot;: { // main reply data
&quot;random&quot;: { // (topic name)
&quot;includes&quot;: {}, // included topics
&quot;inherits&quot;: {}, // inherited topics
&quot;triggers&quot;: [ // array of triggers
{
&quot;trigger&quot;: &quot;hello bot&quot;,
&quot;reply&quot;: [], // array of replies
&quot;condition&quot;: [], // array of conditions
&quot;redirect&quot;: &quot;&quot;, // @ redirect command
&quot;previous&quot;: null, // % previous command
},
...
]
}
},
&quot;objects&quot;: [ // parsed object macros
{
&quot;name&quot;: &quot;&quot;, // object name
&quot;language&quot;: &quot;&quot;, // programming language
&quot;code&quot;: [], // object source code (in lines)
}
]
}
</code></pre>

<p>onError function receives: <code>(err string[, filename str, line_no int])</code></p>
<h2>string stringify (data deparsed)</h2>
Expand Down
Loading

0 comments on commit 30d176f

Please sign in to comment.