learn: function(args, usr) {
var command;
try {
command = JSON.parse(args);
}
catch (e) {
bot.reply(e.message, usr);
throw e;
}
if (!command.name || !command.input || !command.output) {
bot.reply('Illegal /learn object ' + args, usr);
return;
}
//a shitty way to do it, I know
if (!(command.input instanceof Object)) {
command.input = {
pattern: command.input,
flags: ''
};
}
command.input.pattern = command.input.pattern.replace(/~./g, function(c) {