diff --git a/commands/add.js b/commands/add.js index a5a5e48..ec443f4 100644 --- a/commands/add.js +++ b/commands/add.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'add', @@ -13,7 +13,7 @@ module.exports = { var link = args[1]; var category = args[2]; - libFlayer.addSource(title, link, category, (err, result) => { + libCore.addSource(title, link, category, (err, result) => { console.log("Result from adding entry", result); if (result) { @@ -22,8 +22,8 @@ module.exports = { message.reply(`${title} already exists in the list of RSS sources`); } - var sources = libFlayer.getSources(); - libFlayer.loadFeeds(); + var sources = libCore.getSources(); + libCore.loadFeeds(); }); } catch (err) { console.log(err); diff --git a/commands/category.js b/commands/category.js index b9cd55b..8a5429c 100644 --- a/commands/category.js +++ b/commands/category.js @@ -1,10 +1,10 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'categories', description: 'Categories', execute(message) { - var cats = libFlayer.getCategories(); + var cats = libCore.getCategories(); message.reply( `Categories: [${cats.join(', ')}]` diff --git a/commands/chat.js b/commands/chat.js index f9e47b8..1e72dc5 100644 --- a/commands/chat.js +++ b/commands/chat.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'chat', @@ -11,7 +11,7 @@ module.exports = { try { var question = encodeURIComponent(args.join(" ")); - var response = await libFlayer.getChat(question); + var response = await libCore.getChat(question); message.reply(`${message.author.username} ${response}`); } catch (err) { diff --git a/commands/find.js b/commands/find.js index cc53eda..b5d1453 100644 --- a/commands/find.js +++ b/commands/find.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'find', @@ -16,7 +16,7 @@ module.exports = { let i = 0; let iSave = 0 let count = 0; - var feedArray = libFlayer.getFeeds(); + var feedArray = libCore.getFeeds(); var searchString = ""; var foundError = false; feedArray.forEach(linkFlay => { diff --git a/commands/food.js b/commands/food.js index 5c3a3ca..65cfab2 100644 --- a/commands/food.js +++ b/commands/food.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'food', @@ -6,7 +6,7 @@ module.exports = { async execute(message, args) { try { - var resultArray = await libFlayer.getFood(); + var resultArray = await libCore.getFood(); message.reply(` [**${resultArray.strMeal}** - *${resultArray.strCategory}*] diff --git a/commands/get.js b/commands/get.js index 837f59b..63edc77 100644 --- a/commands/get.js +++ b/commands/get.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'get', @@ -12,7 +12,7 @@ module.exports = { } var search = args[0]; var catName = "All"; - var feedArray = libFlayer.getFeeds(); + var feedArray = libCore.getFeeds(); message.reply(`**Retrieving**: [${catName}] (${feedArray[search].link})`); } catch (err) { message.reply(err.toString()); diff --git a/commands/quotes.js b/commands/quotes.js index 0c3300d..a0f7bfa 100644 --- a/commands/quotes.js +++ b/commands/quotes.js @@ -1,11 +1,11 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); const quote_url = "https://zenquotes.io/api/quotes/"; module.exports = { name: 'quote', description: 'Quote!', async execute(message) { try { - var quotes = await libFlayer.getQuotes(quote_url); + var quotes = await libCore.getQuotes(quote_url); var selectedQuote = Math.floor(Math.random() * quotes.length); message.reply(quotes[selectedQuote].quoteText + " - " + quotes[selectedQuote].quoteAuthor); } catch (e) { diff --git a/commands/random.js b/commands/random.js index 34a8e60..4fc6b70 100644 --- a/commands/random.js +++ b/commands/random.js @@ -1,8 +1,9 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'random', - description: 'Random', + description: 'Get a random link from one of the RSS feeds.', + example: "random [category]", execute(message, args) { try { var category = ""; @@ -12,10 +13,10 @@ module.exports = { catName = category; } - var feedArray = libFlayer.getFeeds(category); + var feedArray = libCore.getFeeds(category); var i = Math.floor(Math.random() * (feedArray.length - 0) + 0); - message.reply(`**Retrieving**: [${catName}](${feedArray[i].link})`); + message.reply(`**Retrieved**: [${catName}](${feedArray[i].link})`); } catch (err) { message.reply(err.toString()); } diff --git a/commands/remove.js b/commands/remove.js index ea09324..7acdb23 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'remove', @@ -11,7 +11,7 @@ module.exports = { } var title = args[0]; - libFlayer.deleteSource(title, (err, result) => { + libCore.deleteSource(title, (err, result) => { console.log("Result from removing entry", result); if (result) { @@ -20,8 +20,8 @@ module.exports = { message.reply(`${title} does not exist in the list of RSS sources`); } - var sources = libFlayer.getSources(); - libFlayer.loadFeeds(); + var sources = libCore.getSources(); + libCore.loadFeeds(); }); } catch (err) { console.log(err); diff --git a/commands/slang.js b/commands/slang.js index d897b55..a2bca4c 100644 --- a/commands/slang.js +++ b/commands/slang.js @@ -1,8 +1,9 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'slang', - description: 'Slang', + description: 'Search Urban Dictionary for a phrase.', + example: "slang \"[phrase to search]\"", async execute(message, args) { try { if (args.length < 1) { @@ -11,7 +12,7 @@ module.exports = { } var question = encodeURIComponent(args.join(" ")); - var slangData = await libFlayer.getSlang(question); + var slangData = await libCore.getSlang(question); message.reply(`**Term**: ${decodeURIComponent(question)}\n\n**Answer**: ${slangData.definition}\n\n**Example**: ${slangData.example}`); } catch (e) { message.reply(e.toString()); diff --git a/commands/sources.js b/commands/sources.js index 9031442..c6d5dd4 100644 --- a/commands/sources.js +++ b/commands/sources.js @@ -1,11 +1,11 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'sources', description: 'List RSS Sources', execute(message, args) { - var sourceArray = libFlayer.getSources(); + var sourceArray = libCore.getSources(); var sourceString = ""; sourceArray.forEach(source => { sourceString +=`[${source.title}](${source.link}) \n`; diff --git a/commands/update.js b/commands/update.js index facfbc2..bc802db 100644 --- a/commands/update.js +++ b/commands/update.js @@ -1,4 +1,4 @@ -var libFlayer = require("../libFlayer.js"); +var libCore = require("../libCore.js"); module.exports = { name: 'update', @@ -6,11 +6,11 @@ module.exports = { execute(message, args) { message.reply(`Loading Feeds from Sources`); try { - libFlayer.loadFeeds(); + libCore.loadFeeds(); } catch (error) { console.log(error); } - feedArray = libFlayer.getFeeds(); + feedArray = libCore.getFeeds(); } }; \ No newline at end of file diff --git a/index.js b/index.js index b6f7d98..c284aa9 100644 --- a/index.js +++ b/index.js @@ -24,14 +24,14 @@ const client = new Client({ const PORT = process.env.PORT || 3000; const express = require("express"); const server = express(); -var libFlayer = require("./libFlayer.js"); +var libCore = require("./libCore.js"); let linkFlayerMap = []; server.all("/", (req, res) => { var htmlOutput = "LinkFlayer Bot is Ready - Sources loading
"; - var sources = libFlayer.getSources(); + var sources = libCore.getSources(); sources.forEach(source => { htmlOutput += `
@@ -56,8 +56,8 @@ function keepAlive() { server.listen(PORT, () => { console.log("Keep Alive Server Running"); try { - libFlayer.loadFeeds(); - libFlayer.feedArray = libFlayer.getFeeds(); + libCore.loadFeeds(); + libCore.feedArray = libCore.getFeeds(); } catch (error) { console.log(error); } @@ -78,12 +78,6 @@ for (const file of commandFiles) { client.commands.set(command.name, command); } -/* -for (const file of commandFiles) { - const command = require(`./commands/${file}`); - client.commands.set(command.name, command); -} -*/ client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }); @@ -127,7 +121,7 @@ keepAlive(); client.login(token); //Load Client Discord Token try { console.log("Loading initial startup feeds"); - libFlayer.loadFeeds(); + libCore.loadFeeds(); } catch (error) { console.log(error); } \ No newline at end of file