Fix crashing if user does not have a feed list and tries to add a feed
This commit is contained in:
parent
2ec02130b0
commit
9ec788b71a
@ -68,14 +68,19 @@ async function feed(nick, setting, value) {
|
|||||||
consoleLog('[options.feed] '+nick+' is adding '+value)
|
consoleLog('[options.feed] '+nick+' is adding '+value)
|
||||||
await testFeed(value);
|
await testFeed(value);
|
||||||
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
||||||
var feedsArr = uconfig[nick].feeds
|
try {
|
||||||
if (feedsArr.includes(value) == true) {
|
var feedsArr = uconfig[nick].feeds
|
||||||
errorMessage("null", "ALREADYEXISTS", value)
|
if (feedsArr.includes(value) == true) {
|
||||||
} else {
|
errorMessage("null", "ALREADYEXISTS", value)
|
||||||
file.append(nick+".feeds", value);
|
return;
|
||||||
file.save();
|
}
|
||||||
sendUpstream(value + ' added to your feed list')
|
} catch (e) {
|
||||||
|
consoleLog('[options.feed] No user feed list in usersettings.json, it will be made')
|
||||||
}
|
}
|
||||||
|
file.append(nick+".feeds", value);
|
||||||
|
file.save();
|
||||||
|
sendUpstream(value + ' added to your feed list')
|
||||||
|
|
||||||
}
|
}
|
||||||
if (setting === 'list') {
|
if (setting === 'list') {
|
||||||
content = [];
|
content = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user