Fixed bug in RSS engine

This commit is contained in:
Logan Cusano
2023-02-26 05:09:45 -05:00
parent 85b5ed02cf
commit a9bc2383ba
4 changed files with 38 additions and 53 deletions

View File

@@ -7,7 +7,6 @@ var http = require('http');
const fs = require('fs');
require('dotenv').config();
const libCore = require("./libCore");
const { RSSController } = require("./controllers/rssController");
const libUtils = require("./libUtils");
const deployCommands = require("./utilities/deployCommands");
@@ -15,10 +14,6 @@ const deployCommands = require("./utilities/deployCommands");
const { DebugBuilder } = require("./utilities/debugBuilder");
const log = new DebugBuilder("server", "index");
const {
Routes
} = require('discord-api-types/v9');
//const Discord = require('discord.js');Client, Collection, Intents
const {
Client,
@@ -36,6 +31,7 @@ const client = new Client({
prefix = process.env.PREFIX
discordToken = process.env.TOKEN;
rssTimeoutValue = process.env.RSS_TIMEOUT_VALUE ?? 300000;
var indexRouter = require('./routes/index');
var nodesRouter = require('./routes/nodes');
@@ -85,7 +81,7 @@ app.use((err, req, res, next) => {
/**
* Start the HTTP background server
*/
function runHTTPServer() {
async function runHTTPServer() {
var server = http.createServer(app);
server.listen(port);
@@ -96,6 +92,14 @@ function runHTTPServer() {
})
}
/**
* Start the RSS background process
*/
async function runRssService() {
const rssController = new RSSController(client);
rssController.start();
}
// Discord bot config
// Setup commands for the Discord bot
@@ -124,9 +128,8 @@ client.on('ready', () => {
log.DEBUG(`Starting HTTP Server`);
runHTTPServer();
log.DEBUG("Loading new posts");
const rssManager = new RSSController(client);
rssManager.start();
log.DEBUG("Starting RSS watcher");
runRssService();
});
// Setup any additional event handlers