This commit is contained in:
Entarno54 2025-05-05 18:33:08 +07:00
parent 58eef9bea0
commit 993d2d600d
4 changed files with 15 additions and 7 deletions

2
.idea/SquogBot.iml generated
View File

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13 virtualenv at ~/PycharmProjects/SquogBot1/.venv" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.13 (SquogBot)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

2
.idea/misc.xml generated
View File

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.13 (SquogBot)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 virtualenv at ~/PycharmProjects/SquogBot1/.venv" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (SquogBot)" project-jdk-type="Python SDK" />
</project>

View File

@ -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))
bot.add_cog(Fun(bot))

View File

@ -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))