Working on bug in leaving

This commit is contained in:
Logan Cusano
2022-02-27 19:00:55 -05:00
parent 7682d8c72c
commit b721fa3df4

7
bot.py
View File

@@ -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)