Browse Source

Fix empty RSS feed crash

master
benji7425 3 years ago
parent
commit
f1c12c8a19
  1. 6
      CHANGELOG.md
  2. 17
      app/models/feed-data.js
  3. 2
      package.json

6
CHANGELOG.md

@ -1,5 +1,11 @@
# Changelog
## v3.1.1
### Fixed
- Empty RSS feed crash
## v3.1.0
### Added

17
app/models/feed-data.js

@ -77,16 +77,19 @@ module.exports = class FeedData {
return;
}
const latest = normaliseUrl(articles[0].link);
if (articles.length > 0) {
if (!this.cachedLinks.includes(latest)) {
this.cachedLinks.push(latest);
const latest = normaliseUrl(articles[0].link);
const channel = guild.channels.get(this.channelID),
role = guild.roles.get(this.roleID);
if (!this.cachedLinks.includes(latest)) {
this.cachedLinks.push(latest);
channel.send((role || "") + formatPost(articles[0]))
.catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`));
const channel = guild.channels.get(this.channelID),
role = guild.roles.get(this.roleID);
channel.send((role || "") + formatPost(articles[0]))
.catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`));
}
}
});
}

2
package.json

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

Loading…
Cancel
Save