5 Commits

Author SHA1 Message Date
Logan Cusano
a86e4b2876 Wait for the refresh period before starting RSS feeds 2023-03-13 00:07:07 -04:00
Logan Cusano
a7bcf971c4 Fixed bug when sending DALL-E images 2023-03-13 00:06:39 -04:00
Logan Cusano
f840d754ac Merge branch 'main' of git.vpn.cusano.net:logan/Emmelia-Link-Flayer-Rewrite 2023-03-12 15:54:52 -04:00
Logan Cusano
cb8dfca8dd Return the source title from record promises 2023-03-12 15:54:22 -04:00
d372bcd8af Merge pull request 'feature/merge-multiple-images' (#7) from feature/merge-multiple-images into main
Images will now have their own embeds
2023-03-12 04:39:35 -04:00
3 changed files with 9 additions and 10 deletions

View File

@@ -14,8 +14,8 @@ exports.RSSController = class RSSController {
}
async start(){
// Wait 30 seconds for the rest of the bot to start before starting rss feeds
await new Promise(resolve => setTimeout(resolve, 30000));
// Wait for the refresh period before starting rss feeds, so the rest of the bot can start
await new Promise(resolve => setTimeout(resolve, refreshInterval));
log.INFO("Starting RSS Controller");
// Get initial feeds before the starting the infinite loop

View File

@@ -140,7 +140,7 @@ exports.updateFeeds = (client) => {
if (!sendResults) {
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);
@@ -150,7 +150,7 @@ exports.updateFeeds = (client) => {
if (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) => {
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
Promise.all(sourcePromiseArray).then((values) => {
log.DEBUG("Closing temp connections: ", values);
tempFeedStorage.closeConnection();
tempPostStorage.closeConnection();
log.DEBUG("All sources finished, closing temp connections: ", values);
tempConnection.end();
});
});
}

View File

@@ -88,7 +88,7 @@ exports.sendPost = (post, source, channel, callback) => {
// Check for embedded youtube videos and add the first four as links
const ytVideos = String(post.content).match(youtubeVideoRegex);
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 (ytVideo.includes("embed")) ytVideo = ytVideo.replace("embed/", "watch?v=");
postContent += `\nEmbeded Video from Post: [YouTube](${ytVideo})`
@@ -147,4 +147,4 @@ exports.sendPost = (post, source, channel, callback) => {
exports.returnHash = (...stringsIncluded) => {
return crypto.createHash('sha1').update(`${stringsIncluded.join("-<<??//\\\\??>>-")}`).digest("base64");
}
}