Put the music into a diff process

This commit is contained in:
= 2025-04-06 12:53:12 +07:00
parent 509af870f0
commit 3110b463ef
2 changed files with 26 additions and 12 deletions

11
commands/fun.py Normal file
View File

@ -0,0 +1,11 @@
import nextcord
from nextcord.ext import commands
class Fun(commands.Cog):
def __init__(self, bot):
self.client = bot
# Add something here later cuz im lazy raaahhh
def setup(bot):
bot.add_cog(Fun(bot))

View File

@ -55,7 +55,7 @@ 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.")
print(ctx.guild.voice_client.is_connected()) def Music():
SquogVoiceClient = ctx.guild.voice_client SquogVoiceClient = ctx.guild.voice_client
print(link) print(link)
SquogDownload.download(link) SquogDownload.download(link)
@ -68,6 +68,9 @@ class Voice(commands.Cog):
print(SquogLength) print(SquogLength)
SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3" SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3"
SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}")) SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}"))
print(ctx.guild.voice_client.is_connected())
multiprocessing.Process(Music).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):