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$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" /> <excludeFolder url="file://$MODULE_DIR$/.venv" />
</content> </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" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

2
.idea/misc.xml generated
View File

@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.13 (SquogBot)" /> <option name="sdkName" value="Python 3.13 (SquogBot)" />
</component> </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> </project>

View File

@ -1,9 +1,8 @@
import os
import random
import nextcord import nextcord
from nextcord.ext import commands from nextcord.ext import commands
import random
class Fun(commands.Cog): class Fun(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.client = bot self.client = bot

View File

@ -5,6 +5,9 @@ import os
import threading import threading
SquogFinalName: str = None SquogFinalName: str = None
SquogPlaying = {
}
SquogVideo = { SquogVideo = {
"verbose": True, "verbose": True,
@ -43,6 +46,7 @@ class Voice(commands.Cog):
if ctx.guild.voice_client: if ctx.guild.voice_client:
await ctx.guild.voice_client.disconnect(force=True) await ctx.guild.voice_client.disconnect(force=True)
await ctx.reply("Left.") await ctx.reply("Left.")
SquogPlaying[ctx.guild.id] = False
else: else:
await ctx.reply("Can't leave as i'm not in any voice channel.") 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(): if ctx.guild.voice_client.is_playing():
return await ctx.reply("I'm already playing music.") return await ctx.reply("I'm already playing music.")
# Extracting info for the filename # Extracting info for the filename
SquogPlaying[ctx.guild.id] = True
SquogInfo = SquogDownload.extract_info(link, download=False) SquogInfo = SquogDownload.extract_info(link, download=False)
Embed = nextcord.Embed(title="Loading music", description=SquogDownload.prepare_filename(SquogInfo)) Embed = nextcord.Embed(title="Loading music", description=SquogDownload.prepare_filename(SquogInfo))
@ -77,8 +82,11 @@ class Voice(commands.Cog):
SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3" SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3"
#Starting the music #Starting the music
while SquogPlaying[ctx.guild.id] == True:
SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}")) SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}"))
# I've to start this in a different thread because of how long some videos take to load... # I've to start this in a different thread because of how long some videos take to load...
threading.Thread(target=Process).start() threading.Thread(target=Process).start()
@ -89,6 +97,7 @@ class Voice(commands.Cog):
if not ctx.guild.voice_client.is_playing(): if not ctx.guild.voice_client.is_playing():
return await ctx.reply("I'm not playing music.") return await ctx.reply("I'm not playing music.")
ctx.guild.voice_client.stop() ctx.guild.voice_client.stop()
SquogPlaying[ctx.guild.id] = False
def setup(bot): def setup(bot):
bot.add_cog(Voice(bot)) bot.add_cog(Voice(bot))