From d0b976f7840519cc78e9568177761c86310a7bc8 Mon Sep 17 00:00:00 2001 From: insert Date: Sun, 1 Dec 2024 17:16:12 -0500 Subject: [PATCH] fix queue when only one video --- newbot.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/newbot.py b/newbot.py index dda24bc..82bd64b 100644 --- a/newbot.py +++ b/newbot.py @@ -311,7 +311,10 @@ async def getqueue(inter: disnake.AppCmdInter): await inter.edit_original_response("There are no items in queue") return message = f"Now Playing: <{queue[0]}>\n" - message = message + f"Up Next: <{queue[1]}>\n" + try: + message = message + f"Up Next: <{queue[1]}>\n" + except IndexError: + pass message = message + f"Shuffle is currently " + ("off\n" if not shuffle else "on!\n") res = cur.execute(f"SELECT link FROM queue WHERE hasplayed = false") links = [x[0] for x in res.fetchall()] @@ -339,7 +342,10 @@ async def button_listener(inter: disnake.MessageInteraction): page = page[-1].split(" of ") if inter.component.custom_id == "Forward": message = f"Now Playing: <{queue[0]}>\n" - message = message + f"Up Next: <{queue[1]}>\n" + try: + message = message + f"Up Next: <{queue[1]}>\n" + except IndexError: + pass message = message + f"Shuffle is currently " + ("off\n" if not shuffle else "on!\n") res = cur.execute(f"SELECT link FROM queue WHERE hasplayed = false") links = [x[0] for x in res.fetchall()] @@ -361,7 +367,10 @@ async def button_listener(inter: disnake.MessageInteraction): return if inter.component.custom_id == "Backward": message = f"Now Playing: <{queue[0]}>\n" - message = message + f"Up Next: <{queue[1]}>\n" + try: + message = message + f"Up Next: <{queue[1]}>\n" + except IndexError: + pass message = message + f"Shuffle is currently " + ("off\n" if not shuffle else "on!\n") res = cur.execute(f"SELECT link FROM queue WHERE hasplayed = false") links = [x[0] for x in res.fetchall()]