From dfd4936d795f0294a330c77f107ee2d7cc1d577d Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Wed, 3 Jun 2020 16:16:22 -0700 Subject: [PATCH] [YouTube] Give a friendly message on no results --- youtube/youtube.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/youtube/youtube.py b/youtube/youtube.py index b14e9de..9d75941 100644 --- a/youtube/youtube.py +++ b/youtube/youtube.py @@ -35,13 +35,19 @@ class YouTube(commands.Cog): async def youtube(self, ctx, *, query: str): """Search on Youtube.""" result = await self._youtube_results(query) - await ctx.send(result[0]) + if result: + await ctx.send(result[0]) + else: + await ctx.send("Nothing found. Try again later.") @commands.command() async def ytsearch(self, ctx, *, query: str): """Search on Youtube, multiple results.""" result = await self._youtube_results(query) - await menu(ctx, result, DEFAULT_CONTROLS) + if result: + await menu(ctx, result, DEFAULT_CONTROLS) + else: + await ctx.send("Nothing found. Try again later.") def cog_unload(self): self.bot.loop.create_task(self.session.close())