3e268d2231
Plus fix a couple related issues
27 lines
671 B
JavaScript
27 lines
671 B
JavaScript
const DiscordUtil = require("../../discord-bot-core").util;
|
|
const Core = require("../../discord-bot-core");
|
|
const FeedData = require("./feed-data.js");
|
|
|
|
module.exports = class GuildData extends Core.BaseGuildData {
|
|
constructor({ id, feeds = [] }) {
|
|
super(id);
|
|
this.feeds = feeds.map(feed => new FeedData(feed));
|
|
}
|
|
|
|
cachePastPostedLinks(guild) {
|
|
const promises = [];
|
|
|
|
this.feeds.forEach(feed =>
|
|
promises.push(
|
|
feed.updatePastPostedLinks(guild)
|
|
.catch(err => DiscordUtil.dateError(`Error reading history in ${err.path}`))
|
|
)
|
|
);
|
|
|
|
return Promise.all(promises);
|
|
}
|
|
|
|
checkFeeds(guild) {
|
|
this.feeds.forEach(feed => feed.fetchLatest(guild));
|
|
}
|
|
}; |