Fix empty RSS feed crash
This commit is contained in:
parent
2e985ad5fa
commit
f3c3e57e41
|
@ -1,5 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.1.1
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Empty RSS feed crash
|
||||||
|
|
||||||
## v3.1.0
|
## v3.1.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -77,16 +77,19 @@ module.exports = class FeedData {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const latest = normaliseUrl(articles[0].link);
|
if (articles.length > 0) {
|
||||||
|
|
||||||
if (!this.cachedLinks.includes(latest)) {
|
const latest = normaliseUrl(articles[0].link);
|
||||||
this.cachedLinks.push(latest);
|
|
||||||
|
|
||||||
const channel = guild.channels.get(this.channelID),
|
if (!this.cachedLinks.includes(latest)) {
|
||||||
role = guild.roles.get(this.roleID);
|
this.cachedLinks.push(latest);
|
||||||
|
|
||||||
channel.send((role || "") + formatPost(articles[0]))
|
const channel = guild.channels.get(this.channelID),
|
||||||
.catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`));
|
role = guild.roles.get(this.roleID);
|
||||||
|
|
||||||
|
channel.send((role || "") + formatPost(articles[0]))
|
||||||
|
.catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "3.1.0",
|
"version": "3.1.1",
|
||||||
"main": "app/index.js",
|
"main": "app/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "cd ./discord-bot-core && npm install",
|
"postinstall": "cd ./discord-bot-core && npm install",
|
||||||
|
|
Loading…
Reference in a new issue