From 0484c64fc03a3cc47964baabc231cbbef757ab8f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Oct 2019 16:17:58 -0400 Subject: [PATCH] another way --- r0b3bot.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/r0b3bot.py b/r0b3bot.py index 61d5d87..a8dd4f6 100644 --- a/r0b3bot.py +++ b/r0b3bot.py @@ -85,7 +85,7 @@ async def bitch(ctx): await ctx.send("You are not connected to a voice channel.") return voice: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=ctx.guild) - #voice = get(bot.voice_clients, guild=ctx.guild) + if voice and voice.is_connected(): print(" - Joining voice channel") await voice.move_to(channel) @@ -96,14 +96,9 @@ async def bitch(ctx): #source = FFmpegPCMAudio('./monkey_bitch.mp3') print(" - Creating Player") - player = voice.play(discord.FFmpegPCMAudio('./monkey_bitch.mp3')) + audio_source = discord.FFmpegPCMAudio('./monkey_bitch.mp3') print(" - Playing sound") - player.start() - while not player.is_done(): - print(" - Waiting for player to finish playing") - await asyncio.sleep(1) - player.stop() - print(" - Disconnecting from voice channel") + voice.play(audio_source, after=None) await channel.disconnect() #@bot.command()