fix alias case-sensitivity + fix endless options workers
This commit is contained in:
parent
0403585736
commit
d573bec6ad
2
bot.js
2
bot.js
@ -90,7 +90,7 @@ async function feed(chan, nick, provfeed, n) {
|
|||||||
}
|
}
|
||||||
} else if (uconfig[nick].alias !== undefined ) { //Alias Lookup
|
} else if (uconfig[nick].alias !== undefined ) { //Alias Lookup
|
||||||
consoleLog('[bot.feed] Alias requested')
|
consoleLog('[bot.feed] Alias requested')
|
||||||
var provfeed = uconfig[nick].alias[provfeed]
|
var provfeed = uconfig[nick].alias[provfeed.toUpperCase()]
|
||||||
openPostWorker(chan, "feed-preset", provfeed, n);
|
openPostWorker(chan, "feed-preset", provfeed, n);
|
||||||
} else {
|
} else {
|
||||||
consoleLog('[bot.feed] No valid feed entered')
|
consoleLog('[bot.feed] No valid feed entered')
|
||||||
|
@ -27,8 +27,8 @@ function consoleLog(log) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function sendUpstream(content) {
|
async function sendUpstream(content) {
|
||||||
parentPort.postMessage(content);
|
|
||||||
consoleLog('[options] All done.')
|
consoleLog('[options] All done.')
|
||||||
|
parentPort.postMessage(content);
|
||||||
process.exit()
|
process.exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,19 +97,20 @@ async function feed(nick, setting, value) {
|
|||||||
|
|
||||||
async function alias(setting, value, url, nick) {
|
async function alias(setting, value, url, nick) {
|
||||||
if (setting === 'add') {
|
if (setting === 'add') {
|
||||||
|
var value = value.toUpperCase()
|
||||||
consoleLog('[options.alias] Adding/editing an alias for'+nick+': '+value+' ==> '+url)
|
consoleLog('[options.alias] Adding/editing an alias for'+nick+': '+value+' ==> '+url)
|
||||||
await testFeed(url);
|
await testFeed(url);
|
||||||
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
||||||
file.set(nick+'.alias.'+value, url);
|
file.set(nick+'.alias.'+value.toUpperCase(), url);
|
||||||
file.save();
|
file.save();
|
||||||
sendUpstream('Alias added ('+value+' ==> '+url+')')
|
sendUpstream('Alias added ('+value.toUpperCase()+' ==> '+url+')')
|
||||||
}
|
}
|
||||||
if (setting === 'del') {
|
if (setting === 'del') {
|
||||||
consoleLog('[options.alias] Removing an alias for '+nick+': '+value+' ==> \"\"')
|
consoleLog('[options.alias] Removing an alias for '+nick+': '+value+' ==> \"\"')
|
||||||
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
||||||
file.set(nick+'.alias.'+value, "");
|
file.set(nick+'.alias.'+value.toUpperCase(), "");
|
||||||
file.save();
|
file.save();
|
||||||
sendUpstream('Alias removed ('+value+' ==> BTFO\'d)')
|
sendUpstream('Alias removed ('+value.toUpperCase()+' ==> BTFO\'d)')
|
||||||
}
|
}
|
||||||
if (setting === 'list') {
|
if (setting === 'list') {
|
||||||
content = [];
|
content = [];
|
||||||
@ -141,4 +142,6 @@ if (setting === 'feed') {
|
|||||||
get(setting2);
|
get(setting2);
|
||||||
} else if(setting === 'alias') {
|
} else if(setting === 'alias') {
|
||||||
alias(setting2, value, value2, user)
|
alias(setting2, value, value2, user)
|
||||||
|
} else {
|
||||||
|
sendUpstream(errorMsg+' '+setting+' is not a valid option')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user