Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _playlist_exists_global(self, name):
f = "data/audio/playlists"
f = os.path.join(f, name + ".txt")
log.debug('checking for {}'.format(f))
return dataIO.is_valid_json(f)
def check_file():
f = 'data/antilink/settings.json'
if dataIO.is_valid_json(f) is False:
dataIO.save_json(f, {})
def check_file():
f = 'data/githubcards/settings.json'
if dataIO.is_valid_json(f) is False:
dataIO.save_json(f, {})
def check_files():
system = {}
f = "data/selfrole/config.json"
if not dataIO.is_valid_json(f):
dataIO.save_json(f, system)
def _playlist_exists_global(self, name):
f = "data/audio/playlists"
f = os.path.join(f, name + ".txt")
log.debug('checking for {}'.format(f))
return dataIO.is_valid_json(f)
def check_files():
f = "data/trigger/triggers.json"
if not dataIO.is_valid_json(f):
print("Creating empty triggers.json...")
dataIO.save_json(f, [])
def check_files():
if not dataIO.is_valid_json('data/picwelcome/settings.json'):
defaults = {}
dataIO.save_json('data/picwelcome/settings.json', defaults)
self.path = path
self.check_folders()
self.default_settings = {
"TOKEN": None, #bot token
"BOTSDISCORDPW_TOKEN": None, # https://bots.discord.pw token
"DISCORDBOTSORG_TOKEN": None, # https://discordbots.org token
"OWNER": None, #owner id
"DEVELOPER": None, #dev id
"PREFIXES": [], #server prefix
"DEV_MODE": "0", #dev mode
"default": {"ADMIN_ROLE": "NanoBot Admin",
"MOD_ROLE": "NanoBot Mod"}
}
self._memory_only = False
if not dataIO.is_valid_json(self.path):
self.bot_settings = deepcopy(self.default_settings)
self.save_settings()
else:
current = dataIO.load_json(self.path)
if current.keys() != self.default_settings.keys():
for key in self.default_settings.keys():
if key not in current.keys():
current[key] = self.default_settings[key]
print("Adding " + str(key) +
" field to settings.json")
dataIO.save_json(self.path, current)
self.bot_settings = dataIO.load_json(self.path)
self.save_settings()