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