From 0cdb91a1fb649ac74f54309f6466b12fdaf12ac6 Mon Sep 17 00:00:00 2001 From: hgw Date: Mon, 2 Oct 2023 02:11:25 +0000 Subject: [PATCH] add feed list option --- commands/options.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/commands/options.js b/commands/options.js index 0ea22de..1926911 100644 --- a/commands/options.js +++ b/commands/options.js @@ -30,6 +30,8 @@ function errorMessage(error, code, extra) { var error = errorMsg+' '+extra+' either does not exist or is not a valid feed.' } else if (code == "ALREADYEXISTS" ) { var error = errorMsg+' '+extra+' already exists in your feed list.' + } else if (error == "NOFEEDS") { + var error = errorMsg+" No saved feeds for "+provfeed } else { var error = errorMsg+" Unknown error" } @@ -60,8 +62,25 @@ async function feed(nick, setting, value) { sendUpstream(value + ' added to your feed list') } } + if (setting === 'list') { + content = []; + try { + var feedsArr = uconfig[nick].feeds + console.log(feedsArr) + content.push("These are your added feeds:") + } catch (e) { + errorMessage(e, "NOFEEDS", nick); + } + for (let i = 0; i < feedsArr.length; i++) { + content.push(i+1+'. '+feedsArr[i]) + } + var output = content.join("\n") + sendUpstream(output) + } } if (setting === 'feed') { feed(user, setting2, value); +} else if (setting === 'list') { + feed(user, setting2) }