Put music loading in a different process again

This commit is contained in:
= 2025-04-07 15:23:34 +07:00
parent a5385b2c38
commit 4c7a5225da
2 changed files with 19 additions and 11 deletions

View File

@ -9,6 +9,7 @@ class Fun(commands.Cog):
@commands.command()
async def boop(self, ctx: nextcord.Message, user: nextcord.User):
await ctx.reply(f"{user.mention} shall get booped!", files=[nextcord.File("./images/boop.webp")])
# Add something here later cuz im lazy raaahhh
def setup(bot):

View File

@ -55,19 +55,26 @@ class Voice(commands.Cog):
return await ctx.reply("I'm not in a voice channel.")
if ctx.guild.voice_client.is_playing():
return await ctx.reply("I'm already playing music.")
SquogVoiceClient = ctx.guild.voice_client
print(link)
SquogDownload.download(link)
# Extracting info for the filename
SquogInfo = SquogDownload.extract_info(link, download=False)
SquogFinalName = SquogDownload.prepare_filename(SquogInfo)
SquogLength = SquogFinalName.__len__() - 4
SquogExt = os.path.splitext(SquogFinalName)
print(SquogExt)
SquogLength = SquogFinalName.find(SquogExt[1]) + 1
print(SquogLength)
SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3"
SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}"))
Embed = nextcord.Embed(title="Loading music", description=SquogDownload.prepare_filename(SquogInfo))
# Notifying the user that music is getting started so they know its there
await ctx.reply(embed=Embed)
SquogVoiceClient = ctx.guild.voice_client
def Test():
SquogDownload.download(link)
SquogFinalName = SquogDownload.prepare_filename(SquogInfo)
SquogLength = SquogFinalName.__len__() - 4
SquogExt = os.path.splitext(SquogFinalName)
print(SquogExt)
SquogLength = SquogFinalName.find(SquogExt[1]) + 1
print(SquogLength)
SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3"
SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}"))
multiprocessing.Process(target=Test).start()
@commands.command(description="Stops the music in voice channel")
async def stop(self, ctx: nextcord.Message):