Fix netload not working if there is no whitelist

Closes #20
This commit is contained in:
SileNce5k 2023-04-16 15:31:02 +02:00
parent 7bda48d4a4
commit 998955ed79
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -14,6 +14,10 @@ module.exports = {
"The bot operator also has to have this enabled in the config."
],
execute({ message, args, prefix, client, owners }) {
//check if netload whitelist file exists
if (!fs.existsSync('./data/netmoduleWhitelist.json')) {
fs.writeFileSync('./data/netmoduleWhitelist.json', "[]")
}
let json = fs.readFileSync('./data/netmoduleWhitelist.json', 'utf8');
let whitelist = JSON.parse(json)
if (json.indexOf(message.author.id.toString()) == -1) {