// update eventChat...
function eventChat(sender, to, message) {
if (chat.isBabel(message)) {
eventBabel.apply(this, chat.fromBabel(message));
} else {
eventHuman.call(this, sender, message);
}
}
const AI = true;
const HUMAN = false;
function eventBabel(sender, to, message, dialect, data) {
var reply;
if (dialect in chat.dialects && message in chat.dialects[dialect]) {
// run the command
reply = dialects[dialect][message].call(this, sender, message, data, AI);
// send a reply?
if (reply) chat(sender, chat.toBabel.apply(this, reply));
}
}
function eventHuman(sender, message) {
message = message.split("!").pop().toLowerCase();
var reply;
if (dialect in chat.dialects && message in chat.dialects[dialect]) {
// run the command (note: no data)
reply = dialects[dialect][message].call(this, sender, message, null, HUMAN);
// send a reply?
if (reply) chat(sender, reply);
}
}