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

View File

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