3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00
This commit is contained in:
reality 2014-07-07 11:06:38 +00:00
parent f621fbc38e
commit 01b2d22059
3 changed files with 11 additions and 2 deletions

2
jsbot

@ -1 +1 @@
Subproject commit c8bfa1bd838d8ff074c266055e373e63506e647b Subproject commit 14868e9d935bfd39ba698f6c610fc0c049da2b8a

View File

@ -68,6 +68,10 @@ var api = function(dbot) {
}, },
'resolveChannel': function(server, channelName, callback) { 'resolveChannel': function(server, channelName, callback) {
if(_.has(this.chanCache[server], channelName)) {
return this.api.getChannel(this.chanCache[server][channelName], callback);
}
var channel = false; var channel = false;
this.db.search('channel_users', { this.db.search('channel_users', {
'server': server, 'server': server,
@ -76,9 +80,10 @@ var api = function(dbot) {
channel = result; channel = result;
}, function(err) { }, function(err) {
if(!err) { if(!err) {
this.chanCache[server][channelName] = channel.id;
callback(channel); callback(channel);
} }
}); }.bind(this));
}, },
'getChannel': function(uuid, callback) { 'getChannel': function(uuid, callback) {

View File

@ -11,6 +11,10 @@ var users = function(dbot) {
_.each(dbot.config.servers, function(v, k) { _.each(dbot.config.servers, function(v, k) {
this.userCache[k] = {}; this.userCache[k] = {};
}.bind(this)); }.bind(this));
this.chanCache = {};
_.each(dbot.config.servers, function(v, k) {
this.chanCache[k] = {};
}.bind(this));
/*** Internal API ***/ /*** Internal API ***/
this.internalAPI = { this.internalAPI = {