/* class=gwtchat.server.JavascriptBot */
var turk = new AWSMechanicalTurkClient();
var a, b;
/* Greeting for a new user: */
function greet(chatter) {
a = 2;
b = 7;
chat.say("Hi, "+chatter.name+"! "+
"How much is "+a+"+"+b+"?");
}
/* Reply: */
function hear(chatter, message) {
if (message==a+b) {
chat.say("Good!");
//chat.say(turk.submitAnchor(chatter, "reply="+message));
chat.say(turk.submitForm(chatter, "reply="+message)); // submitForm is more secure - more difficult to hack
} else {
chat.say("Sorry, "+message+" is not the correct answer.");
//chat.say(turk.rejectAssignment(chatter, "Sorry, "+message+" is not the correct answer."));
}
}
End of bot Turker.js