Update RSS messages to send the content in the description
This commit is contained in:
@@ -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] });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user