Working RSS Feeds
- Need to get worker in the background to update the sources
This commit is contained in:
@@ -43,6 +43,5 @@ module.exports = {
|
||||
log.ERROR(err)
|
||||
await interaction.reply(err.toString());
|
||||
}
|
||||
libCore.loadFeeds();
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
const libCore = require("../libCore.js");
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder");
|
||||
const log = new DebugBuilder("server", "get");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('get')
|
||||
.setDescription('Get RSS link by number')
|
||||
.addNumberOption(option =>
|
||||
option.setName('position')
|
||||
.setDescription('The index position of the RSS link')
|
||||
.setRequired(true)),
|
||||
example: "get [1]",
|
||||
isPrivileged: false,
|
||||
requiresTokens: false,
|
||||
async execute(interaction) {
|
||||
try {
|
||||
var search = args[0];
|
||||
var catName = "All";
|
||||
var feedArray = libCore.getFeeds();
|
||||
await interaction.reply(`**Retrieving**: [${catName}] (${feedArray[search].link})`);
|
||||
}catch(err){
|
||||
log.ERROR(err)
|
||||
//await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
var libCore = require("../libCore.js");
|
||||
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder");
|
||||
const log = new DebugBuilder("server", "random");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('random')
|
||||
.setDescription('Get a random link from one of the RSS feeds.')
|
||||
.addStringOption(option =>
|
||||
option.setName('category')
|
||||
.setDescription('Select the category to grab from *(default is "ALL")*')
|
||||
.setRequired(false)),
|
||||
example: "random [category]",
|
||||
isPrivileged: false,
|
||||
requiresTokens: false,
|
||||
async execute(interaction) {
|
||||
try {
|
||||
let category = interaction.options.getString('category');
|
||||
if (!category) category = "ALL";
|
||||
|
||||
var feedArray = libCore.getFeeds(category);
|
||||
var i = Math.floor(Math.random() * (feedArray.length - 0) + 0);
|
||||
|
||||
await interaction.reply(`**Retrieved**: [${category}](${feedArray[i].link})`);
|
||||
} catch (err) {
|
||||
log.ERROR(err)
|
||||
//await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
var libCore = require("../libCore.js");
|
||||
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder");
|
||||
const log = new DebugBuilder("server", "update");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('reload')
|
||||
.setDescription('Reloads all RSS feeds'),
|
||||
example: "reload",
|
||||
isPrivileged: false,
|
||||
requiresTokens: false,
|
||||
async execute(interaction) {
|
||||
try{
|
||||
libCore.loadFeeds();
|
||||
await interaction.reply("Reloaded all RSS feeds");
|
||||
}catch(err){
|
||||
log.ERROR(err)
|
||||
//await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -20,14 +20,13 @@ module.exports = {
|
||||
var title = interaction.options.getString("title");
|
||||
|
||||
libCore.deleteSource(title, (err, result) => {
|
||||
console.log("Result from removing entry", result);
|
||||
log.DEBUG("Result from removing entry", result);
|
||||
|
||||
if (result) {
|
||||
interaction.reply(`Removing ${title} from the list of RSS sources`);
|
||||
} else {
|
||||
interaction.reply(`${title} does not exist in the list of RSS sources`);
|
||||
}
|
||||
libCore.loadFeeds();
|
||||
});
|
||||
}catch(err){
|
||||
log.ERROR(err)
|
||||
|
||||
Reference in New Issue
Block a user