3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +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 // this is retarded
user = user.toLowerCase(); user = user.toLowerCase();
var resolvedUser = _.find(knownUsers.users, function(nick) { var resolvedUser = _.find(knownUsers.users, function(nick) {
var toMatch = new RegExp("/"+user+"/i").compile(); var toMatch = new RegExp(user, "i");
return nick.match(toMatch); return nick.match(toMatch) !== null;
}, this); }, this);
if(!resolvedUser) { if(!resolvedUser) {
resolvedUser = _.find(knownUsers.aliases, function(nick, alias) { resolvedUser = _.find(knownUsers.aliases, function(nick, alias) {
var toMatch = new RegExp("/"+user+"/i").compile(); var toMatch = new RegExp(user, "i");
return alias.match(toMatch); return alias.match(toMatch) !== null;
}, this); }, this);
user = knownUsers.aliases[resolvedUser]; user = knownUsers.aliases[resolvedUser];
} else { } else {