Compare commits

..

No commits in common. "1aa2426213aa5352a5082fe4235640f9b8c71f07" and "5d647ce4c0d6d440229904b05fc1c69f4e8f0c62" have entirely different histories.

13
bot.py
View file

@ -34,7 +34,7 @@ bot = commands.Bot(intents=intents, command_prefix=".", test_guilds=[int(os.gete
@bot.event @bot.event
async def on_ready(): async def on_ready():
global queuetask global queuetask
queuetask = asyncio.create_task(queuehandler()) #this will set the waiting for videos image, then exit queuetask = asyncio.create_task(queuehandler()) #this will just fail but it establishes checks
def play_video(videourl): def play_video(videourl):
driver.get(videourl) driver.get(videourl)
@ -110,9 +110,7 @@ async def getqueue(inter: disnake.AppCmdInter):
await inter.response.defer(ephemeral=True) await inter.response.defer(ephemeral=True)
if not queue: if not queue:
await inter.edit_original_response("There are no items in queue") await inter.edit_original_response("There are no items in queue")
return
message = f"Now Playing: <{queue[0]}>\n" message = f"Now Playing: <{queue[0]}>\n"
message = message + f"Shuffle is currently " + ("off\n" if not shuffle else "on!\n")
for i in range(11): for i in range(11):
if i == 0: if i == 0:
continue continue
@ -128,15 +126,11 @@ async def getqueue(inter: disnake.AppCmdInter):
@bot.listen("on_button_click") @bot.listen("on_button_click")
async def button_listener(inter: disnake.MessageInteraction): async def button_listener(inter: disnake.MessageInteraction):
if not queue:
await inter.response.edit_message("There are no items in queue")
return
ogmsg = inter.message.content ogmsg = inter.message.content
page = ogmsg.split("\n") page = ogmsg.split("\n")
page = page[-1].split(" of ") page = page[-1].split(" of ")
if inter.component.custom_id == "Forward": if inter.component.custom_id == "Forward":
message = f"Now Playing: <{queue[0]}>\n" message = f"Now Playing: <{queue[0]}>\n"
message = message + f"Shuffle is currently " + ("off\n" if not shuffle else "on!\n")
offset = int(int(page[0]) * 10) offset = int(int(page[0]) * 10)
for i in range(11): for i in range(11):
if i == 0: if i == 0:
@ -154,7 +148,6 @@ async def button_listener(inter: disnake.MessageInteraction):
return return
if inter.component.custom_id == "Backward": if inter.component.custom_id == "Backward":
message = f"Now Playing: <{queue[0]}>\n" message = f"Now Playing: <{queue[0]}>\n"
message = message + f"Shuffle is currently " + ("off\n" if not shuffle else "on!\n")
offset = int((int(page[0]) - 2) * 10) offset = int((int(page[0]) - 2) * 10)
for i in range(11): for i in range(11):
if i == 0: if i == 0:
@ -176,7 +169,7 @@ async def button_listener(inter: disnake.MessageInteraction):
@bot.slash_command( @bot.slash_command(
name="toggleplayback", name="toggleplayback",
description="pauses or unpauses the video, does not bypass the video timelimit", description="pauses or unpauses the video",
) )
async def toggleplayback(inter: disnake.AppCmdInter): async def toggleplayback(inter: disnake.AppCmdInter):
await inter.response.defer(ephemeral=True) await inter.response.defer(ephemeral=True)
@ -189,7 +182,7 @@ async def toggleplayback(inter: disnake.AppCmdInter):
@bot.slash_command( @bot.slash_command(
name="skip", name="skip",
description="skips the current 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=False) await inter.response.defer(ephemeral=False)