Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_files():
f = "data/playsound/settings.json"
if not dataIO.is_valid_json(f):
print("Creating data/playsound/settings.json...")
dataIO.save_json(f, {})
soundname + ".*"))
if len(f) < 1:
await self.bot.say(cf.error(
"Sound file not found. Try `{}allsounds` for a list.".format(
ctx.prefix)))
return
elif len(f) > 1:
await self.bot.say(cf.error(
"There are {} sound files with the same name, but different"
" extensions, and I can't deal with it. Please make filenames"
" (excluding extensions) unique.".format(len(f))))
return
if soundname not in self.settings[server.id]:
self.settings[server.id][soundname] = {"volume": default_volume}
dataIO.save_json(self.settings_path, self.settings)
if percent is None:
await self.bot.reply("Volume for {} is {}.".format(
soundname, self.settings[server.id][soundname]["volume"]))
return
self.settings[server.id][soundname]["volume"] = percent
dataIO.save_json(self.settings_path, self.settings)
await self.bot.reply("Volume for {} set to {}.".format(soundname,
percent))