Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@checks.mod_or_permissions(administrator=True)
async def _addsound(self, ctx: commands.Context, link: str=None):
"""Adds a new sound.
Either upload the file as a Discord attachment and make your comment
"[p]addsound", or use "[p]addsound direct-URL-to-file".
"""
await self.bot.type()
server = ctx.message.server
if server.id not in os.listdir(self.sound_base):
os.makedirs(os.path.join(self.sound_base, server.id))
if server.id not in self.settings:
self.settings[server.id] = {}
@checks.mod_or_permissions(administrator=True)
async def _soundvol(self, ctx: commands.Context, soundname: str,
percent: int=None):
"""Sets the volume for the specified sound.
If no value is given, the current volume for the sound is printed.
"""
await self.bot.type()
server = ctx.message.server
if server.id not in os.listdir(self.sound_base):
os.makedirs(os.path.join(self.sound_base, server.id))
if server.id not in self.settings:
self.settings[server.id] = {}