@commands.command(name="disconnect")
async def _disconnect(self, ctx):
voice_state = ctx.author.voice
if voice_state is None:
return
for voice_client in ctx.bot.voice_clients:
if voice_client.channel == ctx.author.voice.channel:
await voice_client.disconnect()
print("disconnected")
The code executes fine but the bot is still in voice chat
I tried changing ctx.bot.voice_clients: to self.bot.voice_clients: but it had no effect. I changed vesrion of discord.py multiple times but im still stuck on this
>Solution :
Did you try await voice_client.disconnect(force=True)
https://discordpy.readthedocs.io/en/stable/api.html#discord.VoiceClient.disconnect
Cant get discord.py bot to disconnect from voice chat