Compare commits
5 Commits
dev
...
a86e4b2876
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a86e4b2876 | ||
|
|
a7bcf971c4 | ||
|
|
f840d754ac | ||
|
|
cb8dfca8dd | ||
| d372bcd8af |
@@ -14,8 +14,8 @@ exports.RSSController = class RSSController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async start(){
|
async start(){
|
||||||
// Wait 30 seconds for the rest of the bot to start before starting rss feeds
|
// Wait for the refresh period before starting rss feeds, so the rest of the bot can start
|
||||||
await new Promise(resolve => setTimeout(resolve, 30000));
|
await new Promise(resolve => setTimeout(resolve, refreshInterval));
|
||||||
|
|
||||||
log.INFO("Starting RSS Controller");
|
log.INFO("Starting RSS Controller");
|
||||||
// Get initial feeds before the starting the infinite loop
|
// Get initial feeds before the starting the infinite loop
|
||||||
|
|||||||
11
libCore.js
11
libCore.js
@@ -140,7 +140,7 @@ exports.updateFeeds = (client) => {
|
|||||||
|
|
||||||
if (!sendResults) {
|
if (!sendResults) {
|
||||||
log.ERROR("No sending results from sending a post: ", sendResults, existingRecord, post);
|
log.ERROR("No sending results from sending a post: ", sendResults, existingRecord, post);
|
||||||
return recordReject();
|
return recordReject("No sending results from sending a post");
|
||||||
}
|
}
|
||||||
|
|
||||||
log.DEBUG("Saving post to database: ", sendResults, post.title, source.channel_id);
|
log.DEBUG("Saving post to database: ", sendResults, post.title, source.channel_id);
|
||||||
@@ -150,7 +150,7 @@ exports.updateFeeds = (client) => {
|
|||||||
|
|
||||||
if (saveResults) {
|
if (saveResults) {
|
||||||
log.DEBUG("Saved results: ", saveResults);
|
log.DEBUG("Saved results: ", saveResults);
|
||||||
return recordResolve();
|
return recordResolve("Saved results", saveResults);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -165,7 +165,7 @@ exports.updateFeeds = (client) => {
|
|||||||
}
|
}
|
||||||
Promise.all(recordPromiseArray).then((values) => {
|
Promise.all(recordPromiseArray).then((values) => {
|
||||||
log.DEBUG("All posts finished for: ", source.title, values);
|
log.DEBUG("All posts finished for: ", source.title, values);
|
||||||
return resolve();
|
return resolve(source.title);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}))
|
}))
|
||||||
@@ -174,9 +174,8 @@ exports.updateFeeds = (client) => {
|
|||||||
// Wait for all connections to finish then close the temp connections
|
// Wait for all connections to finish then close the temp connections
|
||||||
|
|
||||||
Promise.all(sourcePromiseArray).then((values) => {
|
Promise.all(sourcePromiseArray).then((values) => {
|
||||||
log.DEBUG("Closing temp connections: ", values);
|
log.DEBUG("All sources finished, closing temp connections: ", values);
|
||||||
tempFeedStorage.closeConnection();
|
tempConnection.end();
|
||||||
tempPostStorage.closeConnection();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ exports.sendPost = (post, source, channel, callback) => {
|
|||||||
// Check for embedded youtube videos and add the first four as links
|
// Check for embedded youtube videos and add the first four as links
|
||||||
const ytVideos = String(post.content).match(youtubeVideoRegex);
|
const ytVideos = String(post.content).match(youtubeVideoRegex);
|
||||||
if (ytVideos) {
|
if (ytVideos) {
|
||||||
for (const ytVideo of ytVideos.slice(0,4)){
|
for (var ytVideo of ytVideos.slice(0,4)){
|
||||||
// If the video is an embed, replace the embed to make it watchable
|
// If the video is an embed, replace the embed to make it watchable
|
||||||
if (ytVideo.includes("embed")) ytVideo = ytVideo.replace("embed/", "watch?v=");
|
if (ytVideo.includes("embed")) ytVideo = ytVideo.replace("embed/", "watch?v=");
|
||||||
postContent += `\nEmbeded Video from Post: [YouTube](${ytVideo})`
|
postContent += `\nEmbeded Video from Post: [YouTube](${ytVideo})`
|
||||||
|
|||||||
Reference in New Issue
Block a user