There is a problem with the bot that when executing the "leave" command (see below) the bot does not exit the voice chat. The first command works stably, but the second one, when executed, the bot unsubscribes that it has left the voice chat, but does not do so
@bot.command(pass_context = True)
async def join(ctx):
if (ctx.author.voice):
channel = ctx.message.author.voice.channel
await channel.connect()
else:
await ctx.send("First, go to the voice chat")
@bot.command(pass_context = True)
async def leave(ctx):
if (ctx.voice_client):
await ctx.guild.voice_client.disconnect()
await ctx.send("I left the voice chat")
else:
await ctx.send("I am not in voice chat")
I tried changing bool, removing if and else conditions