|
|
|
@ -171,10 +171,6 @@ class _Client extends Client
|
|
|
|
|
}
|
|
|
|
|
async YTFeed()
|
|
|
|
|
{
|
|
|
|
|
//TODO: Allow multiple feeds per channel
|
|
|
|
|
//Rust: FacePunch and Shadowfrax
|
|
|
|
|
//!Needs some other element for comparison other than published date
|
|
|
|
|
|
|
|
|
|
const feeds = await feedM.find().then(feeds=>{return feeds})
|
|
|
|
|
if(feeds.length<1) return
|
|
|
|
|
for(var feed of feeds)
|
|
|
|
@ -216,7 +212,7 @@ class _Client extends Client
|
|
|
|
|
if(!res) return false;
|
|
|
|
|
const channel = this.channels.cache.get(feed.ChannelId);
|
|
|
|
|
if(!channel) return false;
|
|
|
|
|
const lastSentMessage = await channel.messages.fetch().then(res=>
|
|
|
|
|
const lastSentMessage= await channel.messages.fetch().then(res=>
|
|
|
|
|
{
|
|
|
|
|
for(var item of res)
|
|
|
|
|
{
|
|
|
|
@ -226,13 +222,15 @@ class _Client extends Client
|
|
|
|
|
{
|
|
|
|
|
var fields = item[1].embeds[0].fields.filter(x=>x.name === 'PublishedTimeStamp');
|
|
|
|
|
var isFeed = fields.length>0;
|
|
|
|
|
if(isFeed) return fields[0].value
|
|
|
|
|
if(isFeed) return item[1].embeds[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if(!lastSentMessage) sendMessage(res, feed, channel)
|
|
|
|
|
else if(lastSentMessage != res.published) sendMessage(res, feed, channel);
|
|
|
|
|
const lastSentMessagePublished = lastSentMessage.fields[0].value;
|
|
|
|
|
const lastSentMessageChannelURL = lastSentMessage.data.url
|
|
|
|
|
if(!lastSentMessagePublished) sendMessage(res, feed, channel)
|
|
|
|
|
else if(lastSentMessagePublished != res.published && lastSentMessageChannelURL == res.author.url) sendMessage(res, feed, channel);
|
|
|
|
|
})(feed);
|
|
|
|
|
}
|
|
|
|
|
function sendMessage(res, feed, channel)
|
|
|
|
|