adjusting search to handle rss errors

This commit is contained in:
John Facey
2022-01-06 18:58:16 -06:00
parent f4c0cf5fcb
commit 435788fb35

View File

@@ -18,19 +18,35 @@ module.exports = {
let count = 0;
var feedArray = libFlayer.getFeeds();
var searchString = "";
var foundError = false;
feedArray.forEach(linkFlay => {
try {
if (linkFlay.title.toLowerCase().indexOf(search.toLowerCase()) > -1) {
iSave = i;
found = true;
console.log(linkFlay.title);
searchString += `Use !get ${i} to view: ${linkFlay.title} \n`;
count++;
if (count > 5) {
message.reply(searchString);
searchString = "";
}
}
i++;
} catch (error) {
foundError = true;
console.log(error);
}
});
if (foundError) {
message.reply("Error in search");
return;
} else {
message.reply(searchString);
}
if (count == 1) {
//message.channel.send('Displaying 1 result');
//message.channel.send('!get '+iSave);