Catch error in message sending
This commit is contained in:
21
libUtils.js
21
libUtils.js
@@ -79,18 +79,17 @@ exports.sendPost = (post, source, channel, callback) => {
|
|||||||
postSourceLink = postSourceLink.hostname;
|
postSourceLink = postSourceLink.hostname;
|
||||||
const postImage = post.image ?? undefined;
|
const postImage = post.image ?? undefined;
|
||||||
log.DEBUG("Sending an RSS post to discord", postTitle, postId)
|
log.DEBUG("Sending an RSS post to discord", postTitle, postId)
|
||||||
|
|
||||||
const rssMessage = new this.EmmeliaEmbedBuilder()
|
|
||||||
.setColor(0x0099FF)
|
|
||||||
.setTitle(postTitle)
|
|
||||||
.setURL(postLink)
|
|
||||||
.addFields({ name: "Post Content", value: postContent, inline: false })
|
|
||||||
.addFields({ name: 'Published', value: postPubDate, inline: true })
|
|
||||||
.addFields({ name: 'Source', value: postSourceLink, inline: true })
|
|
||||||
|
|
||||||
if (postImage) rssMessage.setImage(postImage);
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
const rssMessage = new this.EmmeliaEmbedBuilder()
|
||||||
|
.setColor(0x0099FF)
|
||||||
|
.setTitle(postTitle)
|
||||||
|
.setURL(postLink)
|
||||||
|
.addFields({ name: "Post Content", value: postContent, inline: false })
|
||||||
|
.addFields({ name: 'Published', value: postPubDate, inline: true })
|
||||||
|
.addFields({ name: 'Source', value: postSourceLink, inline: true });
|
||||||
|
|
||||||
|
if (postImage) rssMessage.setImage(postImage);
|
||||||
|
|
||||||
channel.send({ embeds: [rssMessage] });
|
channel.send({ embeds: [rssMessage] });
|
||||||
return callback(undefined, true);
|
return callback(undefined, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user