3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

and they told me no bru regex is cool u wil hav fun

This commit is contained in:
reality 2013-01-15 19:44:34 +00:00
parent 12db5c64e9
commit 76382a6daa

View File

@ -14,14 +14,14 @@ var api = function(dbot) {
// this is retarded
user = user.toLowerCase();
var resolvedUser = _.find(knownUsers.users, function(nick) {
var toMatch = new RegExp("/"+user+"/i").compile();
return nick.match(toMatch);
var toMatch = new RegExp(user, "i");
return nick.match(toMatch) !== null;
}, this);
if(!resolvedUser) {
resolvedUser = _.find(knownUsers.aliases, function(nick, alias) {
var toMatch = new RegExp("/"+user+"/i").compile();
return alias.match(toMatch);
var toMatch = new RegExp(user, "i");
return alias.match(toMatch) !== null;
}, this);
user = knownUsers.aliases[resolvedUser];
} else {