Here is code to disconnect the bot from vc. But it shows this error
AttributeError: 'Interaction' object has no attribute 'voice_client'
I looked at https://discordpy.readthedocs.io/ and tried to add it manually but it doesn't work.
@bot.tree.command(name="disconnect", description="Disconnect from a vc",guild=guild)
async def disconnect(ctx: commands.Context):
if not ctx.client:
return await ctx.send("I am not in vc")
elif not ctx.user.voice:
return await ctx.send("You are not in vc")
else:
vc: wavelink.Player = ctx.client
await vc.disconnect()
vc.queue.clear()
await ctx.send("Bye-bye")