Update RSS messages to send the content in the description

This commit is contained in:
Logan Cusano
2023-03-29 20:54:24 -04:00
parent edef8a4c7d
commit 1aea162b8f

View File

@@ -85,7 +85,7 @@ exports.sendPost = (post, source, channel, callback) => {
post.content = parse(post['content:encoded'] ?? post.content);
// Get the post content and trim it to length or add a placeholder if necessary
var postText = String(post.content.text);
if (postText.length >= 300) postText = `${postText.slice(0, 300).substring(0, Math.min(String(post.content.text).length, String(post.content.text).lastIndexOf(" ")))}...`;
if (postText.length >= 3800) postText = `${postText.slice(0, 3800).substring(0, Math.min(String(post.content.text).length, String(post.content.text).lastIndexOf(" ")))} [...](${post.link})`;
else if (postText.length === 0) postText = `*This post has no content* [Direct Link](${post.link})`;
postContent = postText;
}
@@ -142,7 +142,8 @@ exports.sendPost = (post, source, channel, callback) => {
}
//Add the main content if it's present
if (postContent) rssMessage.addFields({ name: "Post Content", value: postContent, inline: false })
postContent = postContent.slice(0, 4090);
if (postContent) rssMessage.setDescription({ postContent })
channel.send({ embeds: [rssMessage] });