Block settings command from loading when user settings are disabled

This commit is contained in:
7cc5c4f330d47060 2024-09-18 03:32:18 -04:00
parent 5aafb01b22
commit d98073b9da
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
2 changed files with 5 additions and 0 deletions

View file

@ -1,4 +1,5 @@
const fs = require('fs') const fs = require('fs')
const settings = require("../settings.json")
const cmds = Object.create(null) const cmds = Object.create(null)
const { getMessage } = require('../util/lang.js') const { getMessage } = require('../util/lang.js')
@ -15,6 +16,7 @@ for (const plugin of bpl) {
} }
try { try {
const commandName = plugin.split('.js')[0] const commandName = plugin.split('.js')[0]
if(commandName == "settings" && settings.userSettingsDisabled) continue
if (commandName !== 'help') { if (commandName !== 'help') {
cmds[commandName] = require(`./${plugin}`) cmds[commandName] = require(`./${plugin}`)
if (cmds[commandName].level === undefined) { if (cmds[commandName].level === undefined) {

View file

@ -1,4 +1,5 @@
const fs = require('fs') const fs = require('fs')
const settings = require("../settings.json")
const cmds = Object.create(null) const cmds = Object.create(null)
const bpl = fs.readdirSync('./commands') const bpl = fs.readdirSync('./commands')
for (const plugin of bpl) { for (const plugin of bpl) {
@ -7,6 +8,8 @@ for (const plugin of bpl) {
} }
try { try {
const commandName = plugin.split('.js')[0] const commandName = plugin.split('.js')[0]
console.log(commandName)
if(commandName == "settings" && settings.userSettingsDisabled) continue
cmds[commandName] = require(`../commands/${plugin}`) cmds[commandName] = require(`../commands/${plugin}`)
if (cmds[commandName].level === undefined) { if (cmds[commandName].level === undefined) {
cmds[commandName].level = 0 cmds[commandName].level = 0