Quickfix deleted channels with feeds causing reconnect loop

This commit is contained in:
benji7425 2017-11-14 22:27:58 +00:00
parent f3c3e57e41
commit 723bbb1098
4 changed files with 18 additions and 9 deletions

2
.gitignore vendored
View file

@ -1,6 +1,6 @@
update.sh update.sh
guilds.json guilds.json
token.json token.json*
log log

View file

@ -1,5 +1,11 @@
# Changelog # Changelog
## v3.1.2
### Fixed
- Deleted channels with feeds sending the bot into a reconnect loop
## v3.1.1 ## v3.1.1
### Fixed ### Fixed

View file

@ -11,17 +11,20 @@ module.exports = class GuildData extends Core.BaseGuildData {
cachePastPostedLinks(guild) { cachePastPostedLinks(guild) {
const promises = []; const promises = [];
this.feeds.forEach(feed => this.feeds.forEach(feed => {
promises.push( if (guild.channels.get(feed.channelID))
feed.updatePastPostedLinks(guild) promises.push(
.catch(err => DiscordUtil.dateError(`Error reading history in ${err.path}`)) feed.updatePastPostedLinks(guild)
) .catch(err => DiscordUtil.dateError(`Error reading history in channel ${feed.channelID}: ${err.message || err}`)));
); });
return Promise.all(promises); return Promise.all(promises);
} }
checkFeeds(guild) { checkFeeds(guild) {
this.feeds.forEach(feed => feed.fetchLatest(guild)); this.feeds.forEach(feed => {
if (guild.channels.get(feed.channelID))
feed.fetchLatest(guild);
});
} }
}; };

View file

@ -1,5 +1,5 @@
{ {
"version": "3.1.1", "version": "3.1.2",
"main": "app/index.js", "main": "app/index.js",
"scripts": { "scripts": {
"postinstall": "cd ./discord-bot-core && npm install", "postinstall": "cd ./discord-bot-core && npm install",