/* class=gwtchat.server.JavascriptBot */
/* Greeting for a new user: */
function greet(chatter) {
chat.say(
random(["Hi","Hello","Hi there","Good day"])+". What is your name, stranger?");
}
/* Utility function for getting a random string: */
function random(strings) {
return strings[Math.floor(Math.random()*strings.length)];
}
/* Reply: */
function hear(chatter, message) {
if (/George/.exec(message))
chat.say("Hello, George!");
else if (/Bogdan/.exec(message))
chat.say("Hello, Bogdan!");
else
chat.say("I don't know what to say");
}
End of bot Pattern.js