aichaos / rivescript-go

A RiveScript interpreter for Go. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com/
MIT License
60 stars 16 forks source link

Session Management in RiveScript-go #8

Closed raviteja-ms closed 8 years ago

raviteja-ms commented 8 years ago

Is there any functionality in rivescript-go library to plugin a session manager as in rivescript-python library as this example: https://github.com/aichaos/rivescript-python/tree/master/eg/sessions

If not Please suggest me a method to persistently store the session and chat contexts/history.

kirsle commented 8 years ago

It's on the to-do list. Python didn't get that feature until somewhat recently itself.

In the mean time, there's GetUservars() and SetUservars() so you can export vars, save them to whatever persistent storage you want, and later get them back and put them back into the RiveScript instance. Here's an example (JavaScript), but the logic could be the same: before getting a reply, check if the user has any vars, if not grab them from storage and set them. After the reply, export them all back to storage.

raviteja-ms commented 8 years ago

Okay...!! Thanks for your suggestion. :+1: