diff --git a/bot.py b/bot.py index 728e099..61b81d4 100644 --- a/bot.py +++ b/bot.py @@ -88,7 +88,7 @@ class Bot(commands.Bot): await ctx.send(f"Ok {str(member).capitalize()}, I'm joining {channel}") # Join the voice channel with the audio stream - voice_connection = await channel.connect() + self.voice_connection = await channel.connect() # Create an audio stream from selected device self.streamHandler = sound.PCMStream(self.DEVICE_ID) @@ -96,7 +96,7 @@ class Bot(commands.Bot): self.streamHandler.play() # Play the stream - voice_connection.play(discord.PCMAudio(self.streamHandler)) + self.voice_connection.play(discord.PCMAudio(self.streamHandler)) # Start the SDR and begin playing to the audio stream self.start_sdr() @@ -124,7 +124,8 @@ class Bot(commands.Bot): self.streamHandler.pause() print("Disconnecting") # Disconnect the client from the voice channel - await ctx.voice_client.disconnect() + #await ctx.voice_client.disconnect() + self.voice_connection.disconnect() print("Changing presence") # Change the presence to away and '@ me' await self.set_activity(False)