AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Authentication
 
 

What about authentication with rivescript? Which is a good way to make the users to authenticate and permit rivescript to know with who is chatting with?

 

 
  [ # 1 ]

There’s a couple things you can do for this.

RiveScript’s `reply()` function accepts a user ID parameter along with their message. Making sure the user ID is unique for each user is a good start. For example if your chatbot connects to IRC, use their IRC username there. This keeps all your users’ variables separate from each other, so the bot can learn/remember users’ names and other variables.

What I’ve done in some of my past bots is build in a “botmaster” variable—basically, my bot program would verify whether the user is an “admin” or not, and call the `setUservar()` function to set the variable “botmaster” to be either “true” or “false”. There’s an example here: https://github.com/kirsle/aires-bot/blob/master/brains/RiveScript.pm#L40 and https://github.com/kirsle/aires-bot/blob/master/src/Bot/AiRS.pm#L539

If my bots connect to multiple different networks (that one connects to AOL and Yahoo Messenger), I’d prefix the user’s screen name with the network name, so that a user named “Kirsle” is a different user on each network (“AIM-kirsle” vs. “YMSG-kirsle”). This way I can safely add “AIM-kirsle” to the list of admins in my bot, while not running the risk that a Yahoo account by the same name (but not owned by me) could run any sneaky admin-only commands in my bot.

 

 
  login or register to react