|
|
|
@ -212,6 +212,7 @@ class _Client extends Client
|
|
|
|
|
if(!res) return false;
|
|
|
|
|
const channel = this.channels.cache.get(feed.ChannelId);
|
|
|
|
|
if(!channel) return false;
|
|
|
|
|
var aux = res;
|
|
|
|
|
const lastSentMessage= await channel.messages.fetch().then(res=>
|
|
|
|
|
{
|
|
|
|
|
for(var item of res)
|
|
|
|
@ -222,15 +223,16 @@ class _Client extends Client
|
|
|
|
|
{
|
|
|
|
|
var fields = item[1].embeds[0].fields.filter(x=>x.name === 'PublishedTimeStamp');
|
|
|
|
|
var isFeed = fields.length>0;
|
|
|
|
|
if(isFeed) return item[1].embeds[0];
|
|
|
|
|
if(isFeed && item[1].embeds[0].title == aux.author.name) return item[1].embeds[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const lastSentMessagePublished = lastSentMessage.fields[0].value;
|
|
|
|
|
const lastSentMessageChannelURL = lastSentMessage.data.url
|
|
|
|
|
if(!lastSentMessage) return sendMessage(res, feed, channel);
|
|
|
|
|
const lastSentMessagePublished = lastSentMessage.fields.filter(x=>x.name === 'PublishedTimeStamp')[0].value;
|
|
|
|
|
console.log(lastSentMessagePublished != res.published , 'lastSentPublished',lastSentMessagePublished,'published', res.published)
|
|
|
|
|
if(!lastSentMessagePublished) sendMessage(res, feed, channel)
|
|
|
|
|
else if(lastSentMessagePublished != res.published && lastSentMessageChannelURL == res.author.url) sendMessage(res, feed, channel);
|
|
|
|
|
else if(lastSentMessagePublished != res.published) sendMessage(res, feed, channel);
|
|
|
|
|
})(feed);
|
|
|
|
|
}
|
|
|
|
|
function sendMessage(res, feed, channel)
|
|
|
|
@ -244,7 +246,8 @@ class _Client extends Client
|
|
|
|
|
embed.setTitle(res.author.name);
|
|
|
|
|
embed.setImage(`https://i3.ytimg.com/vi/${res.image}/maxresdefault.jpg`)
|
|
|
|
|
embed.setDescription(feed.CostumMessage);
|
|
|
|
|
embed.addFields({name:'PublishedTimeStamp', value:res.published},
|
|
|
|
|
embed.addFields({name:res.title, value:' '},
|
|
|
|
|
{name:'PublishedTimeStamp', value:res.published},
|
|
|
|
|
{name:'Link:', value:res.link});
|
|
|
|
|
channel.send({embeds:[embed]});
|
|
|
|
|
}
|
|
|
|
|