From 993d2d600dff3fed83420bca0cebcbc7f4838322 Mon Sep 17 00:00:00 2001 From: Entarno54 Date: Mon, 5 May 2025 18:33:08 +0700 Subject: [PATCH] Fixes --- .idea/SquogBot.iml | 2 +- .idea/misc.xml | 2 +- commands/fun.py | 7 +++---- commands/voice.py | 11 ++++++++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.idea/SquogBot.iml b/.idea/SquogBot.iml index e025721..0974f4d 100644 --- a/.idea/SquogBot.iml +++ b/.idea/SquogBot.iml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 16a36fe..c4f9173 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/commands/fun.py b/commands/fun.py index 0016105..86cd13d 100644 --- a/commands/fun.py +++ b/commands/fun.py @@ -1,9 +1,8 @@ -import os -import random - import nextcord from nextcord.ext import commands +import random + class Fun(commands.Cog): def __init__(self, bot): self.client = bot @@ -23,4 +22,4 @@ class Fun(commands.Cog): # Add something here later cuz im lazy raaahhh def setup(bot): - bot.add_cog(Fun(bot)) \ No newline at end of file + bot.add_cog(Fun(bot)) diff --git a/commands/voice.py b/commands/voice.py index 895ec9b..5d5f638 100644 --- a/commands/voice.py +++ b/commands/voice.py @@ -5,6 +5,9 @@ import os import threading SquogFinalName: str = None +SquogPlaying = { + +} SquogVideo = { "verbose": True, @@ -43,6 +46,7 @@ class Voice(commands.Cog): if ctx.guild.voice_client: await ctx.guild.voice_client.disconnect(force=True) await ctx.reply("Left.") + SquogPlaying[ctx.guild.id] = False else: await ctx.reply("Can't leave as i'm not in any voice channel.") @@ -53,6 +57,7 @@ class Voice(commands.Cog): if ctx.guild.voice_client.is_playing(): return await ctx.reply("I'm already playing music.") # Extracting info for the filename + SquogPlaying[ctx.guild.id] = True SquogInfo = SquogDownload.extract_info(link, download=False) Embed = nextcord.Embed(title="Loading music", description=SquogDownload.prepare_filename(SquogInfo)) @@ -77,7 +82,10 @@ class Voice(commands.Cog): SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3" #Starting the music - SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}")) + + while SquogPlaying[ctx.guild.id] == True: + SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}")) + # I've to start this in a different thread because of how long some videos take to load... threading.Thread(target=Process).start() @@ -89,6 +97,7 @@ class Voice(commands.Cog): if not ctx.guild.voice_client.is_playing(): return await ctx.reply("I'm not playing music.") ctx.guild.voice_client.stop() + SquogPlaying[ctx.guild.id] = False def setup(bot): bot.add_cog(Voice(bot)) \ No newline at end of file