var spelling = function(dbot) { var dbot = dbot; var last = {}; return { 'listener': function(data, params) { var q = data.message.valMatch(/^(\*|\*\*)([\d\w\s]*)/, 3); if(q) { var correction = q[1]; var candidates = last[data.channel][data.user].split(' '); var winner = false; var winnerDistance = 99999999; //urgh fix later for(var i=0;i