discord-bot-rss-feed/app/models/guild-data.js
benji7425 9c1252cfd8 Update formatting; convert tabs to 4x spaces
I believe this is the accepted method and should increase default editor compatibility
2018-01-26 23:48:07 +00:00

34 lines
848 B
JavaScript

const Core = require("../../discord-bot-core");
const FeedData = require("./feed-data.js");
module.exports = class GuildData extends Core.BaseGuildData {
constructor() {
super();
this.feeds = [];
this.schema({
feeds: [FeedData]
});
}
cachePastPostedLinks(guild) {
return Promise.all(
this.feeds
.filter(feed => feedIsActive(feed, guild))
.map(feed => feed.updatePastPostedLinks(guild).catch(err => null))
);
}
checkFeeds(guild) {
return Promise.all(
this.feeds
.filter(feed => feedIsActive(feed, guild))
.map(feed => feed.fetchLatest(guild).catch(err => null))
);
}
};
function feedIsActive(feed, guild) {
return guild.channels.get(feed.channelID);
}