Allow bot owners to disable user settings
This commit is contained in:
parent
0147badad3
commit
49485b1040
2 changed files with 14 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
const { languages, getMessage } = require('../util/lang.js')
|
||||
const fs = require('fs')
|
||||
const settings = require('../settings.json')
|
||||
module.exports = {
|
||||
execute: (c) => {
|
||||
if (c.type == 'console') {
|
||||
|
@ -9,6 +10,13 @@ module.exports = {
|
|||
})
|
||||
return
|
||||
}
|
||||
if (settings.userSettingsDisabled) {
|
||||
c.reply({
|
||||
text: getMessage(c.lang, 'command.settings.disabled.global'),
|
||||
color: c.colors.secondary
|
||||
})
|
||||
return
|
||||
}
|
||||
const subcmd = c.args.splice(0, 1)[0]
|
||||
switch (subcmd) {
|
||||
case 'set':{
|
||||
|
|
|
@ -5,11 +5,15 @@ const { getMessage } = require('../util/lang.js')
|
|||
const cmds = require('../util/commands.js')
|
||||
const fs = require('fs')
|
||||
|
||||
if (!fs.readdirSync('.').includes('userPref')) fs.mkdirSync('userPref')
|
||||
if (!fs.readdirSync('.').includes('userPref') && !settings.userSettingsDisabled) fs.mkdirSync('userPref')
|
||||
|
||||
const loadSettings = function (uuid) {
|
||||
try {
|
||||
return require(`../userPref/${uuid}.json`)
|
||||
if(settings.userSettingsDisabled){
|
||||
return {}
|
||||
} else {
|
||||
return require(`../userPref/${uuid}.json`)
|
||||
}
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue