From d3633fc21d6d73ed8a2529b173caf884bd563986 Mon Sep 17 00:00:00 2001 From: reality Date: Fri, 9 Jan 2015 21:25:33 +0000 Subject: [PATCH] new db without resolvchan --- modules/reddit/reddit.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/modules/reddit/reddit.js b/modules/reddit/reddit.js index e51d532..699d4ac 100644 --- a/modules/reddit/reddit.js +++ b/modules/reddit/reddit.js @@ -12,24 +12,18 @@ var reddit = function(dbot) { this.internalAPI = { 'getChannelFeeds': function(server, cName, callback) { - dbot.api.users.resolveChannel(server, cName, function(channel) { - if(channel) { - this.db.read('reddit_feeds', channel.id, function(err, cFeeds) { - if(err || !cFeeds) { - callback(null, { - 'id': channel.id, - 'server': server, - 'channel': cName, - 'feeds': {} - }); - } else { - callback(null, cFeeds); - } + this.db.read('reddit_feeds', cName + '.' + server, function(err, cFeeds) { + if(err || !cFeeds) { + callback(null, { + 'id': cName + '.' + server, + 'server': server, + 'channel': cName, + 'feeds': {} }); } else { - callback('NoSuchChannel', null); + callback(null, cFeeds); } - }.bind(this)); + }); }.bind(this), 'updateChannelFeeds': function(cFeeds, callback) {