Browse Source

don't print the excerpt at all

Excerpts in Russian cause weird bugs
excerpt
Alexander Yakovlev 3 years ago
parent
commit
0b8e772fb6
  1. 11
      app/models/feed-data.js
  2. 3
      package.json

11
app/models/feed-data.js

@ -6,7 +6,6 @@ const Core = require("../../core");
const DiscordUtil = require("../../core").util;
const GetUrls = require("get-urls");
const Url = require("url");
const striptags = require("striptags");
// @ts-ignore
const readFeed = url => promisify(require("rss-parser").parseURL)(url);
@ -110,18 +109,8 @@ module.exports = class FeedData extends Core.BaseEmbeddedData {
function formatPost(article) {
let message = "";
let excerpt = "";
if (article.title) message += `\n**${article.title}**`;
if (article.contentSnippet) {
excerpt = striptags(article.contentSnippet);
}
else if (article.content) {
excerpt = striptags(article.content);
};
if (excerpt.length <= Config.charLimit) {
message += `\n${article.content}`
}
if (article.link) message += `\n\n${normaliseUrlForDiscord(article.link)}`;
return message;

3
package.json

@ -12,8 +12,7 @@
"get-urls": "7.0.0",
"jsonfile": "3.0.1",
"rss-parser": "2.12.0",
"shortid": "2.2.8",
"striptags": "3.1.1"
"shortid": "2.2.8"
},
"name": "discord-bot-rss-feed",
"devDependencies": {},

Loading…
Cancel
Save