3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00
This commit is contained in:
reality 2013-01-15 21:58:47 +00:00
parent 157fe71fc1
commit a433b592c9

View File

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