fix: added handling for if no data path is provided in change_data_path

This commit is contained in:
Seaswimmer 2023-08-01 15:04:36 -04:00
parent f510a54183
commit 1aca41b5c9
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -18,6 +18,8 @@ class MusicDownloader(commands.Cog):
async def change_data_path(self, ctx: commands.Context, data_path: str = None): async def change_data_path(self, ctx: commands.Context, data_path: str = None):
"""This command changes the data path this cog outputs to.""" """This command changes the data path this cog outputs to."""
old_path = await self.config.save_directory() old_path = await self.config.save_directory()
if not data_path:
await ctx.send(f"The current data path is `{old_path}`.")
if os.path.isdir(data_path): if os.path.isdir(data_path):
await self.config.save_directory.set(data_path) await self.config.save_directory.set(data_path)
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"The save directory has been set to `{data_path}`.\n It was previously set to `{old_path}`.") embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"The save directory has been set to `{data_path}`.\n It was previously set to `{old_path}`.")