Skip to content

Commit

Permalink
[Audio] Play local folders via text command (#2457)
Browse files Browse the repository at this point in the history
`[p]local folder` will now accept folder names in the command instead of having to navigate through the reaction menu. Also added an alias of `[p]local start` to help users coming from v2 audio.
  • Loading branch information
aikaterna authored and Tobotimus committed Feb 18, 2019
1 parent 83411d0 commit 7e2e37a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions redbot/cogs/audio/audio.py
Expand Up @@ -554,12 +554,22 @@ async def local(self, ctx):
"""Local playback commands."""
pass

@local.command(name="folder")
async def local_folder(self, ctx):
@local.command(name="folder", aliases=["start"])
async def local_folder(self, ctx, folder=None):
"""Play all songs in a localtracks folder."""
if not await self._localtracks_check(ctx):
return
await ctx.invoke(self.local_play)
if not folder:
await ctx.invoke(self.local_play)
else:
try:
folder_path = os.getcwd() + "/localtracks/{}/".format(folder)
os.listdir(folder_path)
except OSError:
return await self._embed_msg(
ctx, _("No localtracks folder named {name}.").format(name=folder)
)
await self._local_play_all(ctx, folder)

@local.command(name="play")
async def local_play(self, ctx):
Expand Down

0 comments on commit 7e2e37a

Please sign in to comment.