3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 04:02:39 +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 = {
'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) {