I hate voice

This commit is contained in:
Nexus 2023-03-22 15:30:19 +00:00
parent 2054a3ee5a
commit 72d4460e08

View file

@ -228,7 +228,7 @@ class Events(commands.Cog):
if message.author.voice is not None and message.author.voice.channel is not None: if message.author.voice is not None and message.author.voice.channel is not None:
voice: discord.VoiceClient = None voice: discord.VoiceClient = None
if message.guild.me.voice is not None: if message.guild.me.voice is not None:
voice = message.guild.me.voice voice = message.guild.voice_client
else: else:
voice = await message.author.voice.channel.connect() voice = await message.author.voice.channel.connect()
@ -251,10 +251,7 @@ class Events(commands.Cog):
src = discord.FFmpegPCMAudio(str(file.absolute()), stderr=subprocess.DEVNULL) src = discord.FFmpegPCMAudio(str(file.absolute()), stderr=subprocess.DEVNULL)
voice.play( voice.play(
src, src,
after=lambda e: asyncio.run_coroutine_threadsafe( after=after
voice.disconnect(),
self.bot.loop
)
) )
else: else:
await message.channel.trigger_typing() await message.channel.trigger_typing()