Working MySQL Storage system

- testing delete
This commit is contained in:
Logan Cusano
2023-02-20 00:20:46 -05:00
parent 18b960231d
commit 1e6d60f4c3
7 changed files with 253 additions and 222 deletions

View File

@@ -13,16 +13,20 @@ module.exports = {
var link = args[1];
var category = args[2];
var result = libFlayer.addSource(title, link, category);
if (result) {
message.reply(`Adding ${title} to the list of RSS sources`);
} else {
message.reply(`${title} already exists in the list of RSS sources`);
}
libFlayer.addSource(title, link, category, (err, result) => {
console.log("Result from adding entry", result);
var sources = libFlayer.getSources();
libFlayer.loadFeeds();
if (result) {
message.reply(`Adding ${title} to the list of RSS sources`);
} else {
message.reply(`${title} already exists in the list of RSS sources`);
}
var sources = libFlayer.getSources();
libFlayer.loadFeeds();
});
} catch (err) {
console.log(err);
message.reply(err.toString());
}
}

View File

@@ -1,31 +1,42 @@
var libFlayer = require("../libFlayer.js");
const prefix = process.env.prefix;
module.exports = {
name: 'help',
description: 'Help',
execute(message) {
message.reply(
`**!help** - *Lists the available commands*
**!chat** - Queries OpenAI: *!chat what is a pizza*
**!key** - Testing remote Airtable: *!key url*
**!categories** - Displays Categories: *!categories*
**!find** - Searches the RSS Sources: *!find google*
**!get** - Retrieves Search By Index: *!get 25*
**!add** - Add a new RSS Source: *!add http://www.engadget.com/rss.xml*
**!update** - Updates all current RSS Feeds: *!update*
**!quote** - Selects a random quote: *!quote*
**!random** - Selects a random article: *!random*
**!random category** - Selects a random article by category: *!random sports*
**!search** - Instant Live Search: *!search salesforce*
**!slang** - Urban Dictionary Search: *!slang slang*
**!stock** - AlphaVantage Stock Search: *!stock IBM*
**!play** - Plays a trivia game question: *!play*
**!answer** - Answers for a question above: *!answer 1*
**!npm** - Gets NPM info from repository: *!npm axios*
**!alert** - Gets weather alerts for an area: *!alert TX*
**!calc** - Do math: *!calc 2 + 2*
**!food** - Selects a random recipe: *!food*
**!code** - Searches for code snippets: *!code python loop*
`**${prefix}help** - *Lists the available commands*
**${prefix}add** - Add a new RSS Source: *${prefix}add http://www.engadget.com/rss.xml*
**${prefix}alert** - Gets weather alerts for an area: *${prefix}alert TX*
**${prefix}answer** - Answers for a question above: *${prefix}answer 1*
**${prefix}chat** - Queries OpenAI: *${prefix}chat what is a pizza*
**${prefix}calc** - Do math: *${prefix}calc 2 + 2*
**${prefix}categories** - Displays Categories: *${prefix}categories*
**${prefix}code** - Searches for code snippets: *${prefix}code python loop*
**${prefix}find** - Searches the RSS Sources: *${prefix}find google*
**${prefix}food** - Selects a random recipe: *${prefix}food*
**${prefix}get** - Retrieves Search By Index: *${prefix}get 25*
**${prefix}key** - Testing key from storage: *${prefix}key keyName*
**${prefix}npm** - Gets NPM info from repository: *${prefix}npm axios*
**${prefix}quote** - Selects a random quote: *${prefix}quote*
**${prefix}random** - Selects a random article: *${prefix}random*
**${prefix}random category** - Selects a random article by category: *${prefix}random sports*
**${prefix}search** - Instant Live Search: *${prefix}search salesforce*
**${prefix}slang** - Urban Dictionary Search: *${prefix}slang slang*
**${prefix}stock** - AlphaVantage Stock Search: *${prefix}stock IBM*
**${prefix}update** - Updates all current RSS Feeds: *${prefix}update*
`
);
}

31
commands/remove.js Normal file
View File

@@ -0,0 +1,31 @@
var libFlayer = require("../libFlayer.js");
module.exports = {
name: 'add',
description: 'Add RSS Source',
execute(message, args) {
try {
if (args.length < 1) {
message.reply(`Please use in !add [title] format`);
return;
}
var title = args[0];
libFlayer.deleteSource(title, link, category, (err, result) => {
console.log("Result from adding entry", result);
if (result) {
message.reply(`Adding ${title} to the list of RSS sources`);
} else {
message.reply(`${title} already exists in the list of RSS sources`);
}
var sources = libFlayer.getSources();
libFlayer.loadFeeds();
});
} catch (err) {
console.log(err);
message.reply(err.toString());
}
}
};