mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Audio] Catch unhandled internal folder types (#2824)
The `folder:` and `localfolder:` prefixes are used internally with some localtracks strings to define what to do with the item when it's cycled through the search function. Users theoretically should have never seen this issue as [p]search is used on the user side for YouTube and Soundcloud searching and not local searching, but this handles the issue where a folder is being passed to these functions that doesn't exist.
This commit is contained in:
parent
93391d028c
commit
d1593b8069
@ -1211,6 +1211,8 @@ class Audio(commands.Cog):
|
||||
async def _folder_list(self, ctx, folder):
|
||||
if not await self._localtracks_check(ctx):
|
||||
return
|
||||
if not os.path.isdir(os.getcwd() + "/localtracks/{}/".format(folder)):
|
||||
return
|
||||
allowed_files = (".mp3", ".flac", ".ogg")
|
||||
folder_list = sorted(
|
||||
(
|
||||
@ -1237,6 +1239,8 @@ class Audio(commands.Cog):
|
||||
async def _folder_tracks(self, ctx, player, folder):
|
||||
if not await self._localtracks_check(ctx):
|
||||
return
|
||||
if not os.path.isdir(os.getcwd() + "/localtracks/{}/".format(folder)):
|
||||
return
|
||||
local_tracks = []
|
||||
for local_file in await self._all_folder_tracks(ctx, folder):
|
||||
track = await player.get_tracks("localtracks/{}/{}".format(folder, local_file))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user