From 01a60db6027ea24b0ce67b738912f5680983a0c7 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 4 Jun 2018 16:33:53 -0400 Subject: [PATCH] Trim articles that are too long rather than skipping them --- app/models/feed-data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/feed-data.js b/app/models/feed-data.js index aa78ed5..78d5d8c 100644 --- a/app/models/feed-data.js +++ b/app/models/feed-data.js @@ -111,7 +111,7 @@ function formatPost(article) { let message = ""; if (article.title) message += `\n**${article.title}**`; - if (article.content) message += article.content.length > Config.charLimit ? "\nArticle content too long for a single Discord message!" : `\n${article.content}`; + if (article.content) message += article.content.length > Config.charLimit ? `\n${article.content.substr(0, Config.charLimit)}...` : `\n${article.content}`; if (article.link) message += `\n\n${normaliseUrlForDiscord(article.link)}`; return message; @@ -135,4 +135,4 @@ function normaliseYouTubeUrl(origUrl, parsedUrl) { function normaliseUrlForCache(url) { return normaliseUrlForDiscord(url).replace(/^((https?:\/\/)?(www.)?)/, ""); -} \ No newline at end of file +}