config changes are now read at runtime

This commit is contained in:
hgw 2023-10-02 02:11:25 +00:00
parent cd33d16f4d
commit dbb92eba12

8
bot.js
View File

@ -1,5 +1,5 @@
var config = require('./config/default.json'); var config = require('./config/default.json');
var uconfig = require('./config/usersettings.json'); //var uconfig = require('./config/usersettings.json');
var irc = require("irc"); var irc = require("irc");
var fs = require("fs"); var fs = require("fs");
var readline = require('readline'); var readline = require('readline');
@ -74,6 +74,9 @@ async function opt(chan, user, setting, setting2, value, value2) {
} }
async function feed(chan, nick, provfeed, n) { async function feed(chan, nick, provfeed, n) {
var userconf = fs.readFileSync('./config/usersettings.json')
var uconfig = JSON.parse(userconf)
//var uconfig = require('./config/usersettings.json');
if (provfeed === undefined) { if (provfeed === undefined) {
bot.say(chan, errorMsg+" No feed has been provided.") bot.say(chan, errorMsg+" No feed has been provided.")
return; return;
@ -84,6 +87,9 @@ async function feed(chan, nick, provfeed, n) {
var n = config.feed.default_amount; var n = config.feed.default_amount;
} }
console.log(isValidUrl(provfeed))
console.log(provfeed === nick)
console.log(uconfig[nick].alias !== undefined)
if (isValidUrl(provfeed) === true) { if (isValidUrl(provfeed) === true) {
const worker = new Worker('./commands/feed-preset.js', { const worker = new Worker('./commands/feed-preset.js', {
workerData: { workerData: {