$.on('command', function (event) { var sender = event.getSender(); var username = $.username.resolve(sender); var command = event.getCommand(); var s; if (command.equalsIgnoreCase("8ball")) { if (args.length == 0) { $.say ("error."); return; } var table = new Array(); table.push("Yes."); table.push("No."); table.push("Maybe."); table.push("I don't think so!"); table.push("I'll think about it..."); table.push("Why not?"); table.push("Simple yes will do from me!"); table.push("Signs point to yes."); table.push("Reply hazy, try again."); table.push("Without a doubt."); table.push("My sources say no."); table.push("As I see it, yes."); table.push("You may rely on it."); table.push("Concentrate and ask again."); table.push("Outlook not so good."); table.push("It is decidedly so."); table.push("Better not tell you now."); table.push("Very doubtful."); table.push("Yes - definitely."); table.push("It is certain."); table.push("Cannot predict now."); table.push("Most likely."); table.push("Ask again later"); table.push("My reply is no."); table.push("Outlook good."); table.push("Don't count on it."); table.push("Yes, in due time."); table.push("My sources say no."); table.push("Definitely not."); table.push("You will have to wait."); table.push("I have my doubts."); table.push("Outlook so so."); table.push("Looks good to me!"); table.push("Who knows?"); table.push("Looking good!"); table.push("Are you kidding?"); table.push("Go for it!"); table.push("Don't bet on it."); table.push("Probably."); table.push("Forget about it."); do { s = $.randElement(table); } while (s.equalsIgnoreCase($var.lastRandom) && table.length > 1); $.say(s); } }); $.registerChatCommand("8ball");