3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 12:12:35 +01:00

new db without resolvchan

This commit is contained in:
reality 2015-01-09 21:25:33 +00:00
parent 5621bad05c
commit d3633fc21d

View File

@ -12,24 +12,18 @@ var reddit = function(dbot) {
this.internalAPI = { this.internalAPI = {
'getChannelFeeds': function(server, cName, callback) { 'getChannelFeeds': function(server, cName, callback) {
dbot.api.users.resolveChannel(server, cName, function(channel) { this.db.read('reddit_feeds', cName + '.' + server, function(err, cFeeds) {
if(channel) { if(err || !cFeeds) {
this.db.read('reddit_feeds', channel.id, function(err, cFeeds) { callback(null, {
if(err || !cFeeds) { 'id': cName + '.' + server,
callback(null, { 'server': server,
'id': channel.id, 'channel': cName,
'server': server, 'feeds': {}
'channel': cName,
'feeds': {}
});
} else {
callback(null, cFeeds);
}
}); });
} else { } else {
callback('NoSuchChannel', null); callback(null, cFeeds);
} }
}.bind(this)); });
}.bind(this), }.bind(this),
'updateChannelFeeds': function(cFeeds, callback) { 'updateChannelFeeds': function(cFeeds, callback) {