Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord.py 2.0.0 voice chat disconnection problem

@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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading