fix queue being too long and other random issues

This commit is contained in:
insert 2024-07-18 07:59:24 -04:00
parent ca886b1c71
commit 662f25fab8
Signed by: insert
GPG key ID: A70775C389ACF105

9
bot.py
View file

@ -89,13 +89,12 @@ async def play(inter: disnake.AppCmdInter, link: str):
) )
async def shuffleplay(inter: disnake.AppCmdInter, toggle: str = commands.Param(choices=["on", "off"])): async def shuffleplay(inter: disnake.AppCmdInter, toggle: str = commands.Param(choices=["on", "off"])):
await inter.response.defer(ephemeral=True) await inter.response.defer(ephemeral=True)
global shuffle
if toggle == "on": if toggle == "on":
global shuffle
shuffle = True shuffle = True
await inter.edit_original_response(f"shuffle enabled") await inter.edit_original_response(f"shuffle enabled")
return return
else: else:
global shuffle
shuffle = False shuffle = False
await inter.edit_original_response(f"shuffle disabled") await inter.edit_original_response(f"shuffle disabled")
return return
@ -114,7 +113,7 @@ async def getqueue(inter: disnake.AppCmdInter):
message = message + f"Now playing: <{item}>\n" message = message + f"Now playing: <{item}>\n"
continue continue
message = message + f"{idx}. <{item}>\n" message = message + f"{idx}. <{item}>\n"
await inter.edit_original_response(message) await inter.edit_original_response(message[:2000]) #its possible for the queue to be longer then discords max allowed
@bot.slash_command( @bot.slash_command(
name="toggleplayback", name="toggleplayback",
@ -134,7 +133,7 @@ async def toggleplayback(inter: disnake.AppCmdInter):
description="skips the current video DON'T SKIP LESS THAN 18 SECONDS INTO A VIDEO", description="skips the current video DON'T SKIP LESS THAN 18 SECONDS INTO A VIDEO",
) )
async def skip(inter: disnake.AppCmdInter): async def skip(inter: disnake.AppCmdInter):
await inter.response.defer(ephemeral=True) await inter.response.defer(ephemeral=False)
global queuetask global queuetask
queuetask.cancel() queuetask.cancel()
try: try:
@ -146,7 +145,7 @@ async def skip(inter: disnake.AppCmdInter):
driver.fullscreen_window() driver.fullscreen_window()
else: else:
queuetask = asyncio.create_task(queuehandler()) queuetask = asyncio.create_task(queuehandler())
await inter.edit_original_response("skipepd") await inter.edit_original_response("skipped")
@bot.slash_command( @bot.slash_command(
name="remove", name="remove",