RIVESCRIPT(1p)
π RIVESCRIPT π
okay bestie, so this is the manual page for rivescript β a command line frontend to the Perl RiveScript interpreter β and it lives in the User Contributed Perl Documentation corner of your system, section 1p. pull up a chair, we're gonna go through it together π«Ά
β¨ NAME β¨
rivescript β a command line frontend to the Perl RiveScript interpreter. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
$ rivescript [options] [path to RiveScript documents]
π¦ DESCRIPTION π¦
so this is a command line front-end to the RiveScript interpreter, and honestly? she's iconic. this script obsoletes the old rsdemo, and it can also be used non-interactively by third party programs. which is a fancy way of saying: it supports a whole variety of input/output and session handling methods, so you can slot her into whatever setup you've got going on β¨
and if you're like "bestie I don't have a path to give you" β no worries. if no RiveScript document path is given, it will default to the example brain that ships with the RiveScript module, which is based on the Eliza bot. classic. a legend. π
π OPTIONS π
--debug,-dβ turns on debug mode. this prints ALL the debug data from RiveScript straight to your terminal. and if you'd rather it log to a file instead? use the--logoption instead of--debug, not me having opinions π--log FILEβ enables debug mode and prints the debug output toFILEinstead of to your terminal. it's giving "I want the receipts, just not on my screen" π--json,-jβ runsrivescriptin JSON mode, for running the script in a non-interactive way (for example, to use RiveScript in a programming language that doesn't have a native RiveScript library). see "JSON Mode" for the details, iykyk. π₯--data JSON_DATAβ when you're using the--jsonoption, you can provide the JSON input message as a command line argument with the--dataoption. if you don't provide it, then the JSON data will be read from standard input instead. so this option is helpful if you don't want to open a two-way pipe, but rather pass the message as a command line argument and just read the response from standard output. see "JSON Mode" for more details, bestie π--listen,-l [ADDRESS:]PORTβ runsrivescriptin TCP mode, for running the script as a server daemon. if an address isn't specified, it will bind tolocalhost. see "TCP Mode" for details. she's hosting, periodt π--strict,--nostrictβ enables strict mode for the RiveScript parser. it's enabled by default, so use--nostrictto disable it. strict mode prevents the parser from continuing when it finds a syntax error in the RiveScript documents. so basically she stops and goes "no β€οΈ" instead of powering through the mess.--depth=50β override the default recursion depth limit. this controls how many times RiveScript will recursively follow redirects to other replies. the default is50. don't go infinite on her, okay? π--utf8,-uβ use the UTF-8 option in RiveScript. this allows triggers to contain foreign characters and relaxes the filtering of user messages. this is not enabled by default! so if you want the global energy, you gotta opt in πβ¨--helpβ displays this documentation in your terminal. hi, you are here π
π USAGE π
π¬ Interactive Mode π¬
this is the default mode used when you run rivescript without specifying another mode. it behaves similarly to the old rsdemo script and lets you chat one-on-one with your RiveScript bot. just you and her. main character energy fr fr π
and like, this mode can be used to test your RiveScript bot. example:
$ rivescript /path/to/rs/files
π JSON Mode π
this mode should be used when calling from a third party program. in this mode, data that enters and leaves the script are encoded in JSON. very structured. very demure. β¨
example:
$ rivescript --json /path/to/rs/files
the format for incoming JSON data is as follows:
{
"username": "localuser",
"message": "Hello bot!",
"vars": {
"name": "Aiden"
}
}
here, username is a unique name for the user, message is their message to the bot, and vars is a hash of any user variables your program might be keeping track of (such as the user's name and age). she's keeping notes, okay? π
the response from rivescript will look like the following:
{
"status": "ok",
"reply": "Hello, human!",
"vars": {
"name": "Aiden"
}
}
here, status will be ok or error, reply is the bot's response to your message, and vars is a hash of the current variables for the user (so that your program can save them somewhere). bestie, she's handing your data back to you so you don't lose it πΎ
πΈ Standard Input or Data πΈ
by default, JSON mode will read from standard input to receive your JSON message. as an alternative to this, you can provide the --data option to rivescript to present the incoming JSON data as a command line argument. π
this may be helpful if you don't want to open a two-way pipe to rivescript, and would rather pass your input as a command line argument and simply read the response from standard output. lowkey the chillest way to do it.
example:
$ rivescript --json --data '{"username": "localuser", "message": "hello" }' \
/path/to/rs/files
this will cause rivescript to print its JSON response to standard output and exit. and heads up β you can't have a stateful session using this method. it's giving "blink and she's gone" π
π End of Message π
there are two ways you can use the JSON mode: "fire and forget," or keep a stateful session open. pick your fighter β¨
in "fire and forget," you open the program, print your JSON input and send the EOF signal, and then rivescript sends you the JSON response and exits. one message, one reply, done, no strings attached π¦
in a stateful session mode, you must send the text __END__ on a line by itself after you finish sending your JSON data. then rivescript will process it, return its JSON response and then also say __END__ at the end. she says it back. communication. it's a whole thing π
example:
{
"username": "localuser",
"message": "Hello bot!",
"vars": {}
}
__END__
and the response:
{
"status": "ok",
"reply": "Hello, human!",
"vars": {}
}
__END__
this way you can reuse the same pipe to send and receive multiple messages. recycling queen π
π TCP Mode π
TCP Mode will make rivescript listen on a TCP socket for incoming connections. this way you can connect to it from a different program (for example, a CGI script or a program written in a different language). she's branching out, networking era π₯
example:
$ rivescript --listen localhost:2001
TCP Mode behaves similarly to JSON Mode; the biggest difference is that it will read and write using a TCP socket instead of standard input and output. unlike JSON Mode, however, TCP Mode always runs in a stateful way (the JSON messages must end with the text "__END__" on a line by itself). see "End of Message". no fire-and-forget here, she wants the full conversation π«Ά
β οΈ and if the __END__ line isn't found after 20 lines of text are read from the client, it will give up and send the client an error message (encoded in JSON) and disconnect it. so like, don't ghost her for more than 20 lines, bestie. she WILL hang up π
π SEE ALSO π
RiveScript, the Perl RiveScript interpreter. that's her. that's the one. go look π
π AUTHOR π
Noah Petherbridge, http://www.kirsle.net
π LICENSE π
RiveScript - Rendering Intelligence Very Easily
Copyright (C) 2012 Noah Petherbridge
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
and that's the whole page, bestie π this one's from perl v5.36.0, dated 2022-12-23, and it lives under RIVESCRIPT(1p) β go forth and chat with your bot, you've got this πππ¦
π¦ where this page comes from
- debian bookworm: librivescript-perl 2.0.4-1 Β· MIT
- debian trixie: librivescript-perl 2.0.4-1 Β· MIT
- ubuntu noble: librivescript-perl 2.0.4-1 Β· MIT
- ubuntu resolute: librivescript-perl 2.0.4-1 Β· MIT
- ubuntu stonking: librivescript-perl 2.0.4-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms