Initial Emmelia merge

This commit is contained in:
Logan Cusano
2023-05-06 14:56:51 -04:00
parent 6e8af5dbcc
commit f3a4f25f85
44 changed files with 5530 additions and 1115 deletions

47
Server/commands/add.js Normal file
View File

@@ -0,0 +1,47 @@
const libCore = require("../libCore.js");
const { SlashCommandBuilder } = require('discord.js');
const { DebugBuilder } = require("../utilities/debugBuilder");
const log = new DebugBuilder("server", "add");
module.exports = {
data: new SlashCommandBuilder()
.setName('add')
.setDescription('Add RSS Source')
.addStringOption(option =>
option.setName('title')
.setDescription('The title of the RSS feed')
.setRequired(true))
.addStringOption(option =>
option.setName('link')
.setDescription('The link to the RSS feed')
.setRequired(true))
.addStringOption(option =>
option.setName('category')
.setDescription('The category for the RSS feed *("ALL" by default")*')
.setRequired(false)),
example: "add [title] [https://domain.com/feed.xml] [category]",
isPrivileged: false,
async execute(interaction, args) {
try {
var title = interaction.options.getString('title');
var link = interaction.options.getString('link');
var category = interaction.options.getString('category');
if (!category) category = "ALL";
await libCore.addSource(title, link, category, interaction.guildId, interaction.channelId, (err, result) => {
log.DEBUG("Result from adding entry", result);
if (result) {
interaction.reply(`Adding ${title} to the list of RSS sources`);
} else {
interaction.reply(`${title} already exists in the list of RSS sources`);
}
});
}catch(err){
log.ERROR(err)
await interaction.reply(err.toString());
}
}
};